Skip to content
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

[XNIO-394] Fix closing of SSL connections thus preventing broken pipe errors #259

Merged
merged 6 commits into from
Nov 26, 2021

Conversation

fl4via
Copy link
Contributor

@fl4via fl4via commented Nov 26, 2021

…nduits/channels/connection in JsseSSlConduitEngine until closeEngine runs.

Prevents broken pipe errors, where a shutdown reads here and a shutdown writes there, for example, or a premature close, could lead to the invocation of close listeners or to the closing of conduits before the engine is fully closed.
…d to prevent a broken pipe error on corner cases.

Invoking closeOutbound on a read operation when status is need wrap and doFlush() returned positive can lead to Broken pipe errors
…nt to first handshake.

The special treatment was an attempt to make some corner cases work, such as when closing the channel right away. Not only this is unnecessary, as giving that special treatment can lead to not following the JsseEngine behavior to a T in certain scenarios, as the tests show.
…eft in the buffer before reading from socket.
…ake sure that, no matter what, engine is invoked and waited upon before closing conduits

More info:
- the new state machine makes sure that we behave consistently with regards of readClosed/writeClosed invocations and isRead/WriteShutdown to callers
- internally, though, we do not invoke internal channels and connection until engine has given its okay
- notice that, by having two layers (SSL over non-SSL) and two layers on hierarchy (super class being non-SSL, subclass being SSL), invoking the super class
  methods makes us enter a simpler state machine that just takes care of closing everything if everything is shutdown, this is exactly the issue we want to
  avoid, because not only it can cause Broken pipe errors, but it can also cause a close listener to be invoked and close the connection while read/write
  listeners have not fully taken care of their business
…inition, so sometimes they just fail, and add tests for abrudpt attempts to close the channel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant