GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — fix a race in `click.testing.StreamMixer`'s finalization, seen in a multi-threaded context by neutrinoceros · Pull Request #2991 · pallets/click Conversation
|
| with runner.isolation() as (_, err, _): | ||
| click.echo("\udce2", err=True, nl=False) | ||
|
|
||
| assert err.getvalue() == b"\\udce2" |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
With my patch, stream objects yielded from runner.isolation, including err, may be closed as the context manager exits, dereferencing (hence, allowing gc to collect) its internal StreamMixer reference. Comparable tests already do it this way, so I'm hoping that this change is acceptable.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
345e42b to
30bb693
Compare
30bb693 to
712f3f4
Compare
click.testing.StreamMixer's finalization, seen in a multi-threaded contextclick.testing.StreamMixer's finalization, seen in a multi-threaded context
…en in a multi-threaded context
712f3f4 to
4679b1c
Compare
|
Looks reasonable to me to be merge as-is: as @neutrinoceros pointed out, this is hard to constantly reproduce in unit tests (which should probably be named stress tests in that case), and I doubt lots of Click users are running the code in an intensive multi-threaded context as @neutrinoceros does. So if this PR is breaking anything, we would have already caught the regression. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I just noticed I accidentally linked #824, but again, my patch doesn't actually fix it, so it should be undone before merge. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@neutrinoceros Can you unlink #824. For some reason I cannot. Once you do that I will hit merge. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Weird. It seems I also can't. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@kdeldycke can you give it a try? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Blocked for me to: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
a race condition inclick.testing.StreamMixer's finalization
ValueError: I/O operation on closed file in testing
There was an error while loading. Please reload this page.