Skip to content

Conversation

@hiranya911
Copy link
Contributor

There's a small delay between channelInactive() low-level event, and us calling channel.close(). The former executes on a Netty worker thread, while the latter is on the runloop. An outgoing send() may sneak through this window to cause a hard assertion failure.

The old tubesock implementation handled this type of race conditions more gracefully, by simply logging the error and closing the connection for good. This PR essentially implements the same semantics on top of Netty.

b/74831164

logger.debug("WebSocket reached EOF", e);
} else {
logger.error("WebSocket error", e);
logger.debug("WebSocket error", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it might make sense to still log all other errors at 'error' level? You should really only suppress the IllegalStateException you created in NettyWebsocketClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if (e.getCause() != null && e.getCause() instanceof EOFException) {
logger.error("WebSocket reached EOF", e);
if (e instanceof EOFException
|| (e.getCause() != null && e.getCause() instanceof EOFException)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to perform a null check before calling instanceof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@hiranya911 hiranya911 merged commit a0ffae0 into master Mar 26, 2018
@hiranya911 hiranya911 deleted the hkj-error-log branch March 26, 2018 18:43
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