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
{{ message }}
Repository navigation
Streamed request bodies and cookie jars can still crash the process at exit #612
Streamed request bodies (request.rs) and custom cookie jars (cookies.rs) run user Python code on tokio threads outside the exit gate from #607, so if that code releases the GIL while the interpreter starts finalizing, the process aborts on Python < 3.13.8. This crashes on every run on 3.11:
importasyncio, socket, sys, time, typesimportimpitclassSlowTeardown: # stands in for a big app's interpreter teardowndef__del__(self, _now=time.perf_counter):
end=_now() +0.6while_now() <end:
passm=types.ModuleType('_slow'); m.obj=SlowTeardown(); sys.modules['_slow'] =m; delmserver=socket.create_server(('127.0.0.1', 0)) # accepts the upload, never respondsdefbody():
whileTrue:
time.sleep(0.3) # user code on a tokio thread, GIL releasedyieldb'x'asyncdefmain():
asyncwithimpit.AsyncClient() asclient:
try:
awaitasyncio.wait_for(client.post(f'http://127.0.0.1:{server.getsockname()[1]}/', content=body()), 0.1)
exceptTimeoutError:
passasyncio.run(main())
Activity