Skip to content

Fix task handlers for multiple process instances with same user task IDs#279

Merged
nitram509 merged 4 commits intonitram509:mainfrom
erinoggz:main
Aug 24, 2025
Merged

Fix task handlers for multiple process instances with same user task IDs#279
nitram509 merged 4 commits intonitram509:mainfrom
erinoggz:main

Conversation

@erinoggz
Copy link
Contributor

@erinoggz erinoggz commented Jul 29, 2025

Motivation/Abstract

This is a bug fix for multiple process instances with identical task IDs where only the first created instance could complete its tasks while subsequent instances remained stuck. The findOrCreateJob function was returning existing jobs based only on ElementId, causing job conflicts between different process instances. This fix ensures each process instance gets its own jobs by also checking ProcessInstanceKey during job lookup.

Description/Comments

The bug occurred because findOrCreateJob only checked job.ElementId == be.GetId() when looking for existing jobs, causing jobs to be shared across different process instances that had the same task IDs. The fix adds an additional check for job.ProcessInstanceKey == instance.GetInstanceKey() to ensure proper job isolation per instance. This maintains the intended behavior where jobs are reused within the same process instance but isolated between different instances.

Checklist

Depending on your PR, please ensure the overall consistency/integrity of the project remains.
Please tick just one check item per section below

Tests

  • did you update or create tests for your code changes?
  • not relevant

Code examples

  • did you update or add example code snippets, which relate to your code changes
  • not relevant

Documentation

  • did you update or create documentation, which relates to your code changes
  • not relevant

@nitram509
Copy link
Owner

Excellent catch, thank you @erinoggz for fixing this.
PS: sorry for my late reply, and thanks for the notch at LinkedIn.

@codecov
Copy link

codecov bot commented Aug 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.81%. Comparing base (0e2a093) to head (14ebb9c).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #279   +/-   ##
=======================================
  Coverage   63.81%   63.81%           
=======================================
  Files          28       28           
  Lines        1915     1915           
=======================================
  Hits         1222     1222           
  Misses        647      647           
  Partials       46       46           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nitram509 nitram509 merged commit 1104fb0 into nitram509:main Aug 24, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants