Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

make BatchWorker batch interrupt safe #179

Merged
merged 1 commit into from
Sep 18, 2020

Conversation

jwulf
Copy link
Member

@jwulf jwulf commented Sep 17, 2020

Fixes #177

Proposed Changes

  • Make batch for BatchWorker interrupt safe. Uses Array.splice instead of copying.

@jetdream
Copy link

How is this fixes #177?
In case of receiving data on closing stage it still loses jobs.

To reliably fix this I think the connection must be closed by server, which has to be sure that no jobs lost when closing connection.
At the moment there is no explicit way to ask server to close long polling connection, thus closing can take as long as long polling timeout.

Or might be worth considering introducing acknowledgement-based approach when job is moved to ACTIVATED state only after being acknowledged by job handler.

@jwulf
Copy link
Member Author

jwulf commented Sep 18, 2020

How is this fixes #177?
In case of receiving data on closing stage it still loses jobs.

Closing stage is specifically for application shut down. To trigger that case, you have to call ZBClient.close() or ZBBatchWorker.close().

I think the source of your issue is jobs streaming to the worker while a Batch is executing. It looks like there was a possible race condition: the batch processing uses a copy of the array of jobs. So the batch processor could be invoked with a copy of the batch, and then the batch gets updated.

I replaced the batched jobs array and the call with copy operation with a queue implemented using a mutable array.

@jwulf jwulf merged commit 7fed5ec into camunda-community-hub:master Sep 18, 2020
@jwulf jwulf deleted the fix-177 branch September 18, 2020 00:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Job is activated but is not received by job worker (intermittent issue)
2 participants