FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-114914: Avoid keeping dead StreamWriter alive by CendioOssman · Pull Request #115661 · python/cpython · GitHub

/ cpython Public

gh-114914: Avoid keeping dead StreamWriter alive - #115661

Merged
gvanrossum merged 2 commits into
python:mainfrom
CendioOssman:abandon_stream
Feb 28, 2024
Merged

gh-114914: Avoid keeping dead StreamWriter alive#115661
gvanrossum merged 2 commits into
python:mainfrom
CendioOssman:abandon_stream

Conversation

CendioOssman commented Feb 19, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

In some cases we might cause a StreamWriter to stay alive even when the application has dropped all references to it. This prevents us from doing automatical cleanup, and complaining that the StreamWriter wasn't properly closed.

Fortunately, the extra reference was never actually used for anything so we can just drop it.

In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.
Comment thread Lib/test/test_asyncio/test_streams.py Outdated
addr = srv.sockets[0].getsockname()
with socket.create_connection(addr):
# Give the loop some time to notice the connection
await asyncio.sleep(0.1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Like in the other PR, I believe that one or two sleep(0) should deterministically reach the state you're waiting for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Three, actually.

But I'm cautious about this change. Right now, it seems to require three. But someone might change something so that tomorrow this requires four. At which point this test will start reporting "ok" even if everything is broken. :/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think adding a future to wait on could give something more reliable in this specific case.

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks great. Will merge. Thanks for finding and fixing this!

gvanrossum merged commit a355f60 into python:main Feb 28, 2024
gvanrossum pushed a commit to gvanrossum/cpython that referenced this pull request Feb 28, 2024
In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.
CendioOssman deleted the abandon_stream branch February 28, 2024 10:51

Copy link
Copy Markdown
Member

Please, see #116112

woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
In some cases we might cause a StreamWriter to stay alive even when the
application has dropped all references to it. This prevents us from
doing automatical cleanup, and complaining that the StreamWriter wasn't
properly closed.

Fortunately, the extra reference was never actually used for anything so
we can just drop it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL