You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you reproduce the bug with PYTHONASYNCIODEBUG in env?:
Does uvloop behave differently from vanilla asyncio? How?: have observed the same error on asyncio
I have not been able to come up with a reproduction for this as I think it has something to do with how aws lambda freezes and thaws lambdas.
I have an aws lambda using uvloop that handles requests with using loop.run_until_complete. I can't use uvloop.run or aysncio.run since I need client connected to that loop to still be present on the next invocation of the lambda. Occassionally we have observed errors on the lambda with the following stack trace:
[ERROR] OSError: [Errno 9] Bad file descriptor
Traceback (most recent call last):
File "/my_code.py", line 302, in request_handler
self.loop.run_until_complete(_process_records())
File "uvloop/loop.pyx", line 1511, in uvloop.loop.Loop.run_until_complete
File "uvloop/loop.pyx", line 1504, in uvloop.loop.Loop.run_until_complete
File "uvloop/loop.pyx", line 1377, in uvloop.loop.Loop.run_forever
File "uvloop/loop.pyx", line 547, in uvloop.loop.Loop._run
File "uvloop/loop.pyx", line 348, in uvloop.loop.Loop._pause_signals
File "/root/.pyenv/versions/3.12.1/lib/python3.12/socket.py", line 504, in close
self._real_close()
File "/root/.pyenv/versions/3.12.1/lib/python3.12/socket.py", line 498, in _real_close
_ss.close(self)
Because this error happens before the loop sets it's self._running field to 0 this means on the next invocation of the lambda the call to loop.run_until_complete errors with a loop is already running error.
I think the bad file descriptor is caused by some feature of the lambda environment or it could just be some kind of random chance since we have a lot of these running and this happens on very small fraction (<0.01%).
I wrote this patch to catch and ignore the Bad file descriptor error, but don't know if that's the right thing to do in the absence of real test case. If anyone has ideas about how I could produce a test case I am happy to try them out.
The text was updated successfully, but these errors were encountered:
PYTHONASYNCIODEBUG
in env?:I have not been able to come up with a reproduction for this as I think it has something to do with how aws lambda freezes and thaws lambdas.
I have an aws lambda using uvloop that handles requests with using
loop.run_until_complete
. I can't useuvloop.run
oraysncio.run
since I need client connected to that loop to still be present on the next invocation of the lambda. Occassionally we have observed errors on the lambda with the following stack trace:Because this error happens before the loop sets it's
self._running
field to 0 this means on the next invocation of the lambda the call toloop.run_until_complete
errors with a loop is already running error.I think the bad file descriptor is caused by some feature of the lambda environment or it could just be some kind of random chance since we have a lot of these running and this happens on very small fraction (<0.01%).
I wrote this patch to catch and ignore the Bad file descriptor error, but don't know if that's the right thing to do in the absence of real test case. If anyone has ideas about how I could produce a test case I am happy to try them out.
The text was updated successfully, but these errors were encountered: