Skip to content

Fix: handle exceptions in futures#88

Open
678098 wants to merge 1 commit into
bloomberg:mainfrom
678098:260724_future_exceptions
Open

Fix: handle exceptions in futures#88
678098 wants to merge 1 commit into
bloomberg:mainfrom
678098:260724_future_exceptions

Conversation

@678098

@678098 678098 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Problem: When a control response arrives while a queue is in an unexpected state, the strategy's response handler throws IllegalArgumentException (a QueueStateManager precondition guard) before reaching resultHook(). RequestManager's dispatch only logs the exception, so the strategy is never reset (later ops fail with ALREADY_IN_PROGRESS) and the caller's future never completes.

Fix: Added QueueControlStrategy.setResponseHandler(), which wraps response handlers so that if one throws, the strategy still completes with a failure (UNKNOWN) and resets. Routed all five response registrations (Open/Configure/Close strategies) through it.

@678098
678098 force-pushed the 260724_future_exceptions branch 2 times, most recently from 83c8e61 to c0647dc Compare July 24, 2026 18:02
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
@678098
678098 force-pushed the 260724_future_exceptions branch from c0647dc to 2dc8c2f Compare July 24, 2026 18:02
@678098
678098 requested a review from pniedzielski July 24, 2026 18:03
obj.sendConfigureStreamResponse(request);

// The future must complete with a failure result rather than hang.
assertEquals(ConfigureQueueResult.UNKNOWN, configFuture.get(FUTURE_TIMEOUT));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The future times out in main

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