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

bpo-30698: asyncio shutdown the ssl layer cleanly. #2270

Closed

Conversation

grzgrzgrz3
Copy link
Contributor

@grzgrzgrz3 grzgrzgrz3 commented Jun 18, 2017

Asyncio on shutdown do not send shutdown confirmation to the other side.
_SSLPipe after doing unwrap is calling shutdown calback where transport
is closed and quit ssldata wont be sent. Having this callback in
_SSLPipe feels wrong and its removed.

Removing callback from _SSLPipe.shutdown should not break any api.

https://bugs.python.org/issue30698

@mention-bot
Copy link

@grzgrzgrz3, thanks for your PR! By analyzing the history of the files in this pull request, we identified @1st1, @fafhrd91 and @serhiy-storchaka to be potential reviewers.

ssldata = self._sslpipe.shutdown(self._finalize)
ssldata = self._sslpipe.shutdown()
self._feed_ssl_data(ssldata)
self._finalize()
offset = 1
Copy link
Member

Choose a reason for hiding this comment

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

Do we beed to return here?

Copy link
Contributor Author

@grzgrzgrz3 grzgrzgrz3 Jul 5, 2017

Choose a reason for hiding this comment

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

There is no need. When we return - this code is Omitted :
del self._write_backlog[0]
If _process_write_backlog is called after shutdown, we ll do shutdown again. If we want to return here we need to add del either. I think this may complicate this method even more.

Maybe something like that gist, but code with write blocked on a read is not tested, i will suggest to not make more changes.

I am planing to add more unittests in future and refactor sslproto.

@@ -636,11 +633,12 @@ def _process_write_backlog(self):
self._on_handshake_complete)
offset = 1
else:
ssldata = self._sslpipe.shutdown(self._finalize)
ssldata = self._sslpipe.shutdown()
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to wrap this in try..finally to guarantee that self._finalize will be called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

transport will be closed anyway in self._fatal_error, but why not.

Asyncio on shutdown do not send shutdown confirmation to the other side.
_SSLPipe after doing unwrap is calling shutdown calback where transport
is closed and quit ssldata wont be sent. Having this callback in
_SSLPipe feels wrong and its removed.

Removing callback from _SSLPipe.shutdown should not break any api.
@1st1
Copy link
Member

1st1 commented May 28, 2018

Could you please rebase the PR against the current master? NEWS should be generated with blurb

@csabella
Copy link
Contributor

It appears that the author of the pull request is no longer active. I'm going to close this PR so someone else can create a new one if they are interested.

@csabella csabella closed this Jan 12, 2020
@asvetlov
Copy link
Contributor

Agree, I'm working on the better fix here: #17975

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants