-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1743 from gevent/issue1739.py
Make AsyncResult behave more like in older versions in cross-thread usage
- Loading branch information
Showing
9 changed files
with
284 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Make ``AsyncResult`` print a warning when it detects improper | ||
cross-thread usage instead of hanging. | ||
|
||
``AsyncResult`` has *never* been safe to use from multiple threads. | ||
It, like most gevent objects, is intended to work with greenlets from | ||
a single thread. Using ``AsyncResult`` from multiple threads has | ||
undefined semantics. The safest way to communicate between threads is | ||
using an event loop async watcher. | ||
|
||
Those undefined semantics changed in recent gevent versions, making it | ||
more likely that an abused ``AsyncResult`` would misbehave in ways | ||
that could cause the program to hang. | ||
|
||
Now, when ``AsyncResult`` detects a situation that would hang, it | ||
prints a warning to stderr. Note that this is best-effort, and hangs | ||
are still possible, especially under PyPy 7.3.3. | ||
|
||
At the same time, ``AsyncResult`` is tuned to behave more like it did | ||
in older versions, meaning that the hang is once again much less | ||
likely. If you were getting lucky and using ``AsyncResult`` | ||
successfully across threads, this may restore your luck. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.