Weird socket issues with Upload File Route (Task exception was never retrieved, OSError: [WinError 64]) #1689
-
Hey Guys, We have a very weird issue on our file upload route, sometimes with bad network connections (lost) it happens that we encounter a "Task exception was never retrieved" Message followed by a Socket Error (OSError: [WinError 64] The specified network name is no longer available) Issue happen with unicorn and hypercorn, and only happens on a file upload route. Minimal Example to reproduce
I would ask if you guys can help me to find the root couse of this issue, or give me hints about that. BR Server: import uvicorn
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route
async def test_case(request):
await request.form()
return JSONResponse({'hello': 'world'})
routes = [
Route("/", endpoint=test_case, methods=['POST'])
]
uvicorn.run(
Starlette(debug=True, routes=routes),
reload=False,
log_level="error",
host="0.0.0.0",
port=8088,
) Client: import threading
import requests
def create():
for i in range(100):
test_files = { "image": open("test.jpeg", "rb")}
r = requests.post("http://127.0.0.1:8088/", files=test_files)
if __name__ == "__main__":
threads = []
for i in range(100):
thread = threading.Thread(target=create, args=(), daemon=True)
thread.start()
threads.append(thread) Error: ERROR Task exception was never retrieved
future: <Task finished name='Task-15680987' coro=<IocpProactor.accept.<locals>.accept_coro() done, defined at C:\Program Files\Python39\lib\asyncio\windows_events.py:568> exception=OSError(22, 'The specified network name is no longer available', None, 64, None)>
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 571, in accept_coro
await future
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 817, in _poll
value = callback(transferred, key, ov)
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 560, in finish_accept
ov.getresult()
OSError: [WinError 64] The specified network name is no longer available
ERROR Accept failed on a socket
socket: <asyncio.TransportSocket fd=1192, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 8088)>
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 819, in loop
conn, addr = f.result()
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 571, in accept_coro
await future
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 817, in _poll
value = callback(transferred, key, ov)
File "C:\Program Files\Python39\lib\asyncio\windows_events.py", line 560, in finish_accept
ov.getresult()
OSError: [WinError 64] The specified network name is no longer available Windows 10 Pro |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have created a bug report on cpython because I think maybe its more releated to cpython, we will see =), also the report is updated with more findings. |
Beta Was this translation helpful? Give feedback.
I have created a bug report on cpython because I think maybe its more releated to cpython, we will see =), also the report is updated with more findings.
python/cpython#93821