-
Notifications
You must be signed in to change notification settings - Fork 551
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
asyncio.base_futures.InvalidStateError: invalid state #169
Comments
Ok, I compare the implementation with base loop one and see you don't check does the future is cancelled or not yet. It's bad because it's a real usecase to wrap |
Would you mind making a PR fixing this? |
Well, I've understood the behaviour and Lock is not a problem there at all; the problem is shifting in the source data structure: before exception we read the data which already is related with other caller. But I can to try later. |
Regarding #170: I don't think that copying the approach of BTW, I don't see a unittest to reproduce the bug you're trying to fix. It's absolutely crucial to have a unittest, can you please try to come up with one? |
Well, it more difficult to reproduce than I thought before. I've investigated the problem by write the sequence of operations to the log. The normal pipeline with timeouts is:
In the InvalidStateError the sequence a little bit differ: before Another issue which I have caught -- even if I add a check the result future must not be cancelled (i.e. if it cancelled just return from As a solution I suggest to make a subclass from the base Yes, I've reproduced main situation and can add a unit test for it. The second case is related, but more difficult to be clearly reproduced and can be eliminated by suggested solution as well. |
Co-authored-by: Andrey Egorov <andr06@gmail.com>
Co-authored-by: Andrey Egorov <andr06@gmail.com>
* 'master' of https://github.com/MagicStack/uvloop: Experimental fix for MagicStack#169 Use ssize_t instead of int where necessary Use a proper type for the thread indent. Ignore linting errors in includes/__init__ setup.py: Use raw string for regexp setup.py: Detect if libuv submodule has not been checked out # Conflicts (their side resolved): # tests/test_sockets.py # uvloop/loop.pyx
* 'master' of https://github.com/MagicStack/uvloop: Experimental fix for MagicStack#169 Use ssize_t instead of int where necessary Use a proper type for the thread indent. Ignore linting errors in includes/__init__ setup.py: Use raw string for regexp setup.py: Detect if libuv submodule has not been checked out # Conflicts (their side resolved): # tests/test_sockets.py # uvloop/loop.pyx
Co-authored-by: Andrey Egorov <andr06@gmail.com>
PYTHONASYNCIODEBUG
in env?: NoI work with a raw sockets using
asyncio.Lock
to isolate blocks reading andsock_recv
to communicate inside a Lock section.In a random time first of all I get the following stacktrace:
After that there is a problem with acquiring the Lock: it becomes pass any simultaneously calls.
Now very small information, but I'll try to investigate and reproduce it. And give you more details. But maybe you have a thoughts already?
The text was updated successfully, but these errors were encountered: