-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
RuntimeError: Timeout context manager should be used inside a task #440
Comments
Are You using tornado? |
No just plain asyncio I'm running an aiohttp server that's using uvloop and running inside of gunicorn edit: been looking here szastupov/aiotg#36 |
After following the stack trace for it bit it seems that either botocore or aiohttp is ignoring the edit: botocore is passing a timeout of 60s.....is there a version or a way to get rid of this? edit2: it also seems to just be sqs.send_message and sqs.get_queue_url (sqs problem?) |
hmm, for some reason "current_task" in aiohttp is not finding the current task, can you debug into it to see why that is? Are you using multiple loops? Could there be loop confusion? |
@thehesiod single loop. it's getting |
Could you try to run same code but do not use view just simple |
any way for a simple test case for us to try? |
|
getting this in |
For Tornado there is a workaround: create asyncio task in tornado handler and wait for result:
|
Ok simple test case, not in an aiohttp request
This works. @asvetlov not using tornado :( @thehesiod single thread (unless it's using multiple in the underlying libraries) |
if you provide a encapsulated testcase we can take a look. Another thing, if using multiple threads in 3.5.3+, each thread will get their own loop. |
Every |
I'm seeing the same error when testing with PyTest.
I've boiled this down to the following test code.
Python 3.6.4 with the following installed:
|
Ah, scrub that. Have found that my problem was because the session was being create the constructor rather than inside one of the |
@manicai @thebenwaters any updates? if no testcase going to close in a few days |
@thehesiod No change, the code above will reproduce it but since refactoring to ensure the session is created inside a coroutine instead everything works fine. Thanks. |
@manicai I think |
@manicai how did you enforce? |
I haven't found a good way of enforcing it programmatically. |
Hi, I had some code that used aiohttp websockets that suddenly started raising this exception. The bug was from a class I had made which had a constructor which had a (to me at least) somewhat non-obvious error: Here is an example:
The problem is with the The code When I manually create a new event loop, but doesn't supply this loop to the constructor when creating the class, the session will end up being created with the default event loop, but this is not the event loop which is running the code. The session needs to be created with the same loop that is actually running. After I made sure of this, the issue went away. |
@andersea I will give it a try! |
in that testcase I just verified that the based on this finding are we ok closing this? |
going to close for now, feel free to re-open if my explanation doesn't make sense or if you find another issue. |
Just today I started having this issue when trying (so far just with SQS)
Context i'm calling from inside an aiohttp server request
in the async_send_message function
I'm I doing something obviously wrong?
The text was updated successfully, but these errors were encountered: