Fix operation concurrency and response handling#4096
Open
Bojan131 wants to merge 1 commit intov8/developfrom
Open
Fix operation concurrency and response handling#4096Bojan131 wants to merge 1 commit intov8/developfrom
Bojan131 wants to merge 1 commit intov8/developfrom
Conversation
- Move mutex from individual services to base OperationService with per-operation granularity - Previously all operations shared one global mutex per service, which caused unnecessary blocking between unrelated operations. Now each operationId gets its own mutex. - Clean up mutex when operation completes or fails to prevent memory buildup - Fix updateMinAcksReached ordering in publish-service — was being called after markOperationAsCompleted which could cause a race where the result API returns before the flag is set - Fix result controller to return signatures when status is COMPLETED even if minAcksReached flag wasn't set yet (handles the race condition from the client side too) - Add try/catch around signature loading in result controller to not crash on missing files Made-with: Cursor
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a concurrency issue where all publish/get/update operations shared a single global mutex per service type, and a race condition where the client would poll for results before signatures were ready.
Changes
Per-operation mutex (operation-service.js + all service files)
MinAcksReached ordering (publish-service.js)
Result controller fix (result-http-api-controller-v1.js)
Why
Under parallel load, the global mutex was serializing all operations of the same type. This was unnecessary since operations are independent. The minAcksReached race condition was causing the dkg.js client to get incomplete responses and throw "cannot destructure property identityId" errors.
Made with Cursor