-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevents the connection from being used immediately when WriteTimeoutException
occurs.
#5738
Conversation
…tException` occurs. Motivation: I got a report from LINE internally that the connection was not terminated but hung when the vm instance was shut down due to maintainance of the underlying hyperviser. `operationComplete()` was not called for `Channel.write()` for this abnormal connection. There was neither a normal response nor a failure response. https://github.com/line/armeria/blob/f0ec7cb729d1fb33d238c6ea8fb9af41460ab37d/core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java#L126-L126 As a result, `WriteTimeoutException` occurred and try to reset the connection. https://github.com/line/armeria/blob/f0ec7cb729d1fb33d238c6ea8fb9af41460ab37d/core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java#L331-L331 `failAndReset()` calls `Channel.write(Unpooled.EMPTY_BUFFER)` first and then calls `Channel.close()`. Since `channel.write()` does not respond, the connection cannot be closed. Modifications: - Deactivate `HttpSession` first before proceeding with the reset process. - Unhealthy connections will be cleaned up eventually with `KeeyAliveHandler` by idle timeout. Result: Fixed a bug where a connection was reused after `WriteTimeoutException` occurred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍 👍
core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Motivation:
I got a report from LINE internally where the connection was not
terminated but hung when the VM instance was shut down due to
maintenance of the underlying hypervisor.
operationComplete()
was not called forChannel.write()
for thisabnormal connection. There was neither a normal response nor a failure
response.
armeria/core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java
Line 126 in f0ec7cb
As a result,
WriteTimeoutException
occurred and tried to reset theconnection.
armeria/core/src/main/java/com/linecorp/armeria/client/AbstractHttpRequestHandler.java
Line 331 in f0ec7cb
failAndReset()
callsChannel.write(Unpooled.EMPTY_BUFFER)
first andthen calls
Channel.close()
.armeria/core/src/main/java/com/linecorp/armeria/internal/common/Http1ObjectEncoder.java
Lines 371 to 374 in f0ec7cb
Since
channel.write()
does not respond, the connection cannot beclosed.
Modifications:
HttpSession.deactivate()
tomarkUnacquirable()
for clarity.procedure.
KeeyAliveHandler
by idle timeout.Result:
Fixed a bug where a connection was reused after
WriteTimeoutException
occurred.