-
Notifications
You must be signed in to change notification settings - Fork 565
SSLProtocol violates app Protocol state machine #246
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
Comments
@fantix any thoughts? |
Yes, it makes perfect sense to honor the |
* session closing is now robust; it is safe to await session.close() from anywhere * API change: FinalRPCError removed; raise ReplyAndDisconnect instead. This responds with a normal result, or an error, and then disconnects. e.g. raise ReplyAndDisconnect(23) raise ReplyAndDisconnect(RPCError(1, "message")) * the session base class' private method _close() is removed. Use await close() instead. * workaround uvloop bug `https://github.com/MagicStack/uvloop/issues/246`_
@fantix Do you plan to implement this yourself? |
Yes! I'll create a PR for that. |
@fantix ping |
Ahhh that slipped through the cracks, let me make one PR now. |
* fixes MagicStack#246
* add app state check * fixes #246 * add test to cover the case * CRF: rename states and fix comment
PYTHONASYNCIODEBUG
in env?: YesSome instances of the
Protocol
class assumeconnection_lost()
can only be called ifconnection_made()
was called at some point. This does not appear to be explicitly guaranteed in the Python documentation, but the following comment strongly suggests that intent:https://github.com/python/cpython/blob/master/Lib/asyncio/protocols.py#L84
An error raised during the handshake phase triggers a transition back to
UNWRAPPED
:https://github.com/MagicStack/uvloop/blob/master/uvloop/sslproto.pyx#L504
Following this code path further, we see that it will force close the transport, which triggers a call back to
SSLProtocol.connection_lost()
. This is then forwarded onto the app'sProtocol
instance, even thoughconnection_made()
was never called.Would it be appropriate to change the following guard to also exclude the
UNWRAPPED
state?https://github.com/MagicStack/uvloop/blob/master/uvloop/sslproto.pyx#L337
Alternatively a boolean value could be used to track whether or not
connection_made()
has ever been called.The text was updated successfully, but these errors were encountered: