get_remote_addr return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
See original GitHub issueChecklist
https://github.com/encode/uvicorn/issues/600 same issue like this old one
Describe the bug
on windows,venv
Package Version
------------------ ---------
asgiref 3.4.1
certifi 2021.5.30
charset-normalizer 2.0.4
click 8.0.1
colorama 0.4.4
fastapi 0.68.0
greenlet 1.1.0
h11 0.12.0
idna 3.2
Naked 0.1.31
pip 21.2.3
pycryptodome 3.10.1
pydantic 1.8.2
PyYAML 5.4.1
requests 2.26.0
setuptools 57.4.0
shellescape 3.8.1
SQLAlchemy 1.4.22
starlette 0.14.2
typing-extensions 3.10.0.0
urllib3 1.26.6
uvicorn 0.14.0
wheel 0.36.2
To reproduce
- 1step test.py:
from fastapi import FastAPI
app = FastAPI()
@app.get('/')
async def root():
return {'message': 'hello world'}
- 2step use uvicorn:
uvicorn test:app --reload --port 61111
- 3step open browser and open 127.0.0.1:61111,got no response,and check console got
(total) E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend>uvicorn test:app --reload --port 61111
INFO: Uvicorn running on http://127.0.0.1:61111 (Press CTRL+C to quit)
INFO: Started reloader process [12332] using statreload
INFO: Started server process [10352]
INFO: Waiting for application startup.
INFO: Application startup complete.
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5E8DF10>
transport: <_SelectorSocketTransport fd=904 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5EA2310>
transport: <_SelectorSocketTransport fd=468 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5EA26D0>
transport: <_SelectorSocketTransport fd=908 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
INFO: - "GET / HTTP/1.1" 200 OK
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5E8DF70>
transport: <_SelectorSocketTransport fd=916 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5EA29D0>
transport: <_SelectorSocketTransport fd=920 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Fatal error in server handler
protocol: <uvicorn.protocols.http.h11_impl.H11Protocol object at 0x00000188B5EA2B20>
transport: <_SelectorSocketTransport fd=916 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\server.py", line 92, in handler
await handle_http(
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
protocol.connection_made(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 85, in connection_made
self.client = get_remote_addr(transport)
File "E:\Desktop_Lite_AfterWin7\tiandao\qinmo_enc\backend\total\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
INFO: - "GET / HTTP/1.1" 200 OK
NOTE:
- Please list tracebacks in full (don’t truncate them).
- If relevant, consider turning on DEBUG or TRACE logs for additional details (see the Logging section on https://www.uvicorn.org/settings/ specifically the
log-level
flag). - Consider using
<details>
to make tracebacks/logs collapsible if they’re very large (see https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d). –>
Environment
Running uvicorn 0.14.0 with CPython 3.8.3 on Windows 10 x64
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
ValueError: invalid literal for int() with base 10: '' - Stack Overflow
The end of the error shows the value that was tried to be parsed. As a more clear example. >>> int('55063.000000') Traceback (most...
Read more >Python ValueError: invalid literal for int() with base 10 Solution
In this tutorial, we discuss the ValueError: invalid literal for int() with base 10 error and why it is raised. We walk through...
Read more >how to fix Value Error: invalid literal for int() with base 10
Are you getting how to fix Value Error : invalid literal for int() with base 10 and wondering what it means and how...
Read more >ValueError: invalid literal for int() with base 10: 'blah' - YouTube
The ValueError is thrown when a function's argument is of an inappropriate type.thanks for watching! subscribe(); to support 00110110 ...
Read more >ValueError Invalid Literal For Int With Base 10 - YouTube
To the point discussion of why this ' ValueError : invalid literal for int () with base 10 :' occurs in python and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876#issuecomment-1013101714
Summary
--reload
), not sure about--workers
because we don’t use itSolution
netsh winsock reset
(From https://github.com/nonebot/nonebot2/issues/20#issuecomment-703582940)Since I can’t reproduce the issue, and I didn’t receive any reply about it, I’ll assume that folks can solve the issue with the comment above: https://github.com/encode/uvicorn/issues/1145#issuecomment-1013610173.
I’ll be closing this, but if you have a solution that needs a PR, feel free to create it, and explain how to reproduce, and how the fix works. 🙏