possible bug / regression in new TCP stack #28577
Labels
area: Networking
bug
The issue is a bug, or the PR is fixing a bug
priority: low
Low impact/importance bug
Describe the bug
I believe I've uncovered a bug in the new TCP stack. I only discovered it because
CONFIG_NET_TCP2=y
is selected as the default stack instead of the legacy stack as of this commit 70dae09 and I just happened to rebase my changes on a8ffc03 today.In my scenario, the Greybus service opens 3 TCP server sockets on port 4242, 4243, & 4244. The service thread calls
poll(2)
on a set of pollfds representing those sockets. Whenpoll(2)
returns (i.e. there is traffic on one of the server sockets),accept(2)
is called creating a client socket. A pthread is spawned for the client, and the newly created client socket is passed to the spawned thread. The spawned thread then callspoll(2)
on the client socket, and that is wherepoll(2)
returns 0 witherrno
set to 0, which is indicates a timeout. However,poll(2)
was called with the timeout value set to-1
meaning that it should wait indefinitely until there is traffic.I'll double-check the other flags that were set by the call to
poll(2)
to see if there is anything out of the ordinary, but for now I was just checkingPOLLIN
.I was able to diagnose the issue partially because my application works perfectly with
CONFIG_NET_TCP1=y
.To Reproduce
Heh.. it could take a bit of effort, unfortunately, so I apologize in advance.
Steps to reproduce the behavior:
Follow the steps described in detail here. Note, you will need an ATUSB and a CC1352R1 LaunchXL.
https://gist.github.com/cfriedt/9ad6a10250b5098e1aeb25193c2c9ba3
Instead of checking out https://github.com/cfriedt/zephyr.git, checkout https://github.com/zephyrproject-rtos/zephyr.git.
Apply the patch file here: greybus-not-working-with-tcp2.patch.txt
This should apply cleanly against a8ffc03 from today.
Instead of using the
cc1352r_sensortag
, use thecc1352r1_launchxl
.The bug becomes evident when building with
but the application behaves perfectly when built with
Expected behavior
Impact
For my application, this is a showstopper
Logs and console output
Environment (please complete the following information):
Additional context
I discovered this possible bug while testing the greybus code that I've been working with for about a year. It's fairly stable, but it is thread, socket, and POSIX intensive.
It should be possible to reproduce the issue using a carefully crafted test case though.
The text was updated successfully, but these errors were encountered: