Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process variables turn unexpectedly null when jobs are executed in parallel #4324

Open
1 task
tasso94 opened this issue May 7, 2024 · 0 comments
Open
1 task
Labels

Comments

@tasso94
Copy link
Member

tasso94 commented May 7, 2024

Environment (Required on creation)

Most likely, all Camunda versions are affected.

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

Process variables turn unexpectedly null when jobs are executed in parallel.

Steps to reproduce (Required on creation)

  1. Deploy a process with a flow node (script/service task) that is asyncBefore, which first reads process variable A and second updates process variable A.
  2. State
    • There is a process variable A of type Object.
    • The flow node has two tokens within the same process instance during runtime.
  3. The job executor executes both resulting jobs in parallel.

Observed Behavior (Required on creation)

Process variables turn null.

Expected behavior (Required on creation)

Process variables don't turn null.

Root Cause (Required on prioritization)

  1. T1 executes job 1 that starts executing token 1.
  2. T2 executes job 2 that starts executing token 2, and selects the process variable A, including the referenced byte array row from the database.
  3. T1 continues and updates the process variable A as defined in the script/service task.
    • Since the variable is of type Object, the value is stored in the byte array table, and the row in the runtime variable table references the row in the byte array table.
    • Updating the variable value leads to deleting the byte array row, inserting a new one, and updating the runtime variable row with the new reference.
  4. T1 is done and commits all modifications to the database.
  5. T2 continues and selects the byte array row from the previously selected process variable A.
    • The process variable A was selected before the byte array reference was updated => T2 still uses the state of the process variable A with the outdated byte array reference.
    • The variable A returns null since it doesn't exist anymore.

Solution Ideas

Reuse the byte array row by updating it. Like this, the variable value cannot turn null.

Hints

See the prototypical implementation that was validated with the customer: #4313

Links

Breakdown

Pull Requests

  1. ci:all-db
    tasso94

Dev2QA handover

  • Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment
@tasso94 tasso94 added the type:bug Issues that describe a user-facing bug in the project. label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant