Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-8043

@Dependent scoped beans in EL expressions are prematurely destroyed with Weld versions > 1.1.4

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.8.0, 7.8.0-alpha3
    • Component/s: engine
    • Labels:
      None

      Description

      Problem

      • When using a @Dependent scoped bean in an EL expression, the bean is destroyed while it is still in use; i.e. given an expression ${foo.bar()}, #bar is invoked after foo is destroyed
      • Problem occurs with Weld versions > 1.1.4
      • E.g. JBoss 7.2 uses Weld 1.1.10; Wildfly probably uses newer versions

      Reason

      My interpretation:

      • I think we are using the CDI API incorrectly here. It appears that BeanManager#wrapExpressionFactory is exactly made for this case, i.e. it wraps a given expression factory such that any expressions produced make sure that a creational context is created for the entirety of the EL invocation => we should wrap our expression factory this way
      • This proposed fix is not trivial because
        • We do not use javax.el.ExpressionFactory in our code base but include use our own org.camunda.bpm.engine.impl.javax.el.ExpressionFactory
        • I think this requires to have one expression factory per process application (assuming different applications have different bean managers???), whereas we are currently using one expression factory per process engine
      • Thus, a pragmatic way could be to always look up beans "our" way (catch clause in https://github.com/camunda/camunda-bpm-platform/blob/master/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/impl/el/CdiResolver.java#L61-L70); not sure if that breaks anything else, though

      Related links:

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thorben.lindhauer Thorben Lindhauer
              Reporter:
              thorben.lindhauer Thorben Lindhauer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: