[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #59182] Fresh socket does not raise ENOTCONN
From: |
Gisle Vanem |
Subject: |
[lwip-devel] [bug #59182] Fresh socket does not raise ENOTCONN |
Date: |
Sat, 26 Sep 2020 03:50:24 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 |
URL:
<https://savannah.nongnu.org/bugs/?59182>
Summary: Fresh socket does not raise ENOTCONN
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: gvanem
Submitted on: Sat 26 Sep 2020 07:50:22 AM UTC
Category: sockets/netconn
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
lwIP version: git head
_______________________________________________________
Details:
I have patched MicroPython [1] with LwIP support on Windows.
And running some tcp/ip related test shows a funny behaviour in LwIP.
E.g. from:
https://github.com/micropython/micropython/blob/master/tests/extmod/usocket_tcp_basic.py
# recv() on a fresh socket should raise ENOTCONN
s = socket.socket()
try:
s.recv(1)
except OSError as er:
print("ENOTCONN:", er.args[0] == errno.ENOTCONN)
The trace in LwIP shows:
src/api/sockets.c(1754): lwip_socket(PF_INET, SOCK_STREAM, 0) = 0
src/api/sockets.c(1243): lwip_recvfrom(0, 0E88A030, 1, 0x0, ..)
src/api/sockets.c(976): lwip_recv_tcp: top while sock->lastdata=00000000
Now the MicroPython test hangs forever. Nothing happens
with this socket 0. It's unconnected, so how could this socket
ever receive a single byte?
Using the same .py-test in the real CPython 3.6, it immediately
returns the expected:
py -3 extmod\usocket_tcp_basic.py
ENOTCONN: True
Also not that the sock-fd == 0. Rebuilding LwIP with:
-DLWIP_SOCKET_OFFSET=100
to force a sock-fd to start at 100, does not make any change
to the hang.
[1] https://github.com/micropython/micropython
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?59182>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #59182] Fresh socket does not raise ENOTCONN,
Gisle Vanem <=