forked from line/armeria
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete
DefaultClientRequestContext.whenIntialized()
after fully i…
…nitializing a context (line#3636) Motivation: `LazyDynamicEndpointGroupTest.emptyEndpoint()` sometimes failed in CI builds. line#3381 It expects to fail the test with `EmptyEndpointException`, however, it fails with `ClosedStreamException`. After digging the issue, I find out that there is a race in `whenInitialized`. If the `acquiredEventLoop.execute()` is executed immediately and completed earlier than returning the method, https://github.com/line/armeria/blob/d4880fe12690d2dafd2c5e7fa9f24c3b24837a00/core/src/main/java/com/linecorp/armeria/client/DefaultClientRequestContext.java#L307-L309 the callbacks of `ctx.whenInitialized()` will be invoked before a `RequestLog` is completed. https://github.com/line/armeria/blob/207c5e038f59802dca769936a50e219a5fe308ea/grpc/src/main/java/com/linecorp/armeria/internal/client/grpc/ArmeriaClientCall.java#L337-L348 As the `req` is closed already, the `req.write()` would be failed with `ClosedStreamException`. Modifications: - Complete `DefaultClientRequestContext.whenIntialized()` after `initContextAndExecuteWithFallback` of `ClientUtil` Result: - You no longer see `ClosedStreamException` when an `EndpointGroup` is empty. - Fixes line#3381
- Loading branch information
Showing
2 changed files
with
31 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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