Skip to content

net/sockets/echo_async crashes after several connections (qemu_x86) #9032

@rlubos

Description

@rlubos

I've experienced an echo_async sample crash when I was playing with it on qemu_x86. Actually, it's pretty simple to reproduce, just connect/disconnect a few times with telnet (for me two times is enough). Here's the log:

***** Booting Zephyr OS v1.12.0-880-g86b5edc4d *****
Asynchronous TCP echo server waits for connections on port 4242...
Connection #0 from 192.0.2.2 fd=4198848
poll error: 4
Connection #1 from 192.0.2.2 fd=4198848
poll error: 4
***** CPU Page Fault (error code 0x00000000)
Supervisor thread read address 0x00000000
PDE: 0x025 Present, Read-only, User, Execute Enabled
PTE: 0x00 Non-present, Read-only, Supervisor, Execute Enabled
Current thread ID = 0x00402180
eax: 0x00000000, ebx: 0x00401230, ecx: 0x0041521c, edx: 0x0041527c
esi: 0x00000001, edi: 0x0041527c, ebp: 0x0041520c, esp: 0x004151f8
eflags: 0x00000006 cs: 0x0008
call trace:
eip: 0x00015742
     0x00015940 (0x293)
     0x000056fd (0x415254)
     0x00003c5c (0x400340)
     0x000128ed (0x4153e8)
     0x00003e03 (0x0)
Fatal fault in essential thread! Spinning...

Didn't have too much time to dive in, but the crash itself takes place within k_poll function. Yet it looks that the problem here is that sockets are not being closed. Not sure about the error returned by the poll function (EINTR doesn't look too scary), but the fact that sockets are not closed is disturbing. Perhaps net_context for whatever reason is not notyfing the socket shim about connection being closed, so in result recv and close are not called?

Nothing fancy in wireshark logs, just two opened and closed connections:
image

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions