eclipse-ee4j / eclipse-ee4j/tyrus

Data lost when using SSL and unconsumed data pending when socket closes

Open
#599 4 comments 0 reactions 0 assignees View on GitHub
Component: protocol Priority: Major Type: Bug
Dominant language
Java
Stars
128
Forks
49
PR merge metrics
No merged PRs in 30d

Description

This behavior was observed when connecting to a RabbitMQ server running a WebStomp plugin, and the connection was forcibly closed using RabbitMQ's admin UI. There are probably other, simpler ways to duplicate it. The sequence of events is that RabbitMQ sends an ERROR stomp frame and then quickly disconnects the connection.

When connecting via SSL (ie, with a wss:// URL), the ERROR frame sent across the WebSocket prior to disconnection is never delivered (ie, through TyrusWebSocket.onMessage); however, when connecting unencrypted (ie, with a ws:// URL), the ERROR frame sent prior to disconnection does get delivered.

It appears as though this may be a timing-sensitive issue, and the fact that it takes more time to decrypt the SSL data means that the close event gets handled first, and consequently the data is dropped, rather than handled.

I'm afraid I don't know Tyrus/Grizzly's internals well enough to speculate on how a fix might be implemented to ensure that any pending data was consumed from the WebSocket prior to firing events related to the socket closure.
#### Affected Versions
[1.12]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.