-
-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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-36801: Fix waiting in StreamWriter.drain for closing SSL transport #13098
bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport #13098
Conversation
The backport to 3.7 is desired. |
# ConnectionResetError otherwise | ||
fut = self._protocol._get_close_waiter(self) | ||
await fut | ||
raise ConnectionResetError('Connection lost') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to raise an error from drain()? Maybe it should just return? What's the point of this error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how protocol._drain_helper()
works now.
The future is set to exception only if the connection is closed with a failure.
But await writer.drain()
raises ConnectionResetError
.
I believe this is good: await writer.write(b'data')
should fail loudly if the socket is closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the code could be simplified by setting ConnectionResetError by connection_lost()
callback handler but I'd like to keep the PR small.
Future improvement worth another pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, got it.
Thanks @asvetlov for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
pythonGH-13098) https://bugs.python.org/issue36801 (cherry picked from commit 1cc0ee7) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
GH-13176 is a backport of this pull request to the 3.7 branch. |
GH-13098) https://bugs.python.org/issue36801 (cherry picked from commit 1cc0ee7) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Hi @asvetlov , I ran into a
Note the subprocess ends very soon, and it seems
|
BTW, here are some links I think might be helpful: |
cc @1st1 |
please do not post questions and cc people on long closed/merged PRs. Please use the discuss.python.org Help category - and only when it seems an actual CPython issue has been found, file a new issue in the issue tracker. |
https://bugs.python.org/issue36801