Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: net: sockets: packet: reception stops working after a while #34462

Closed
shlomow opened this issue Apr 21, 2021 · 0 comments · Fixed by #34475
Closed

samples: net: sockets: packet: reception stops working after a while #34462

shlomow opened this issue Apr 21, 2021 · 0 comments · Fixed by #34475
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug

Comments

@shlomow
Copy link
Contributor

shlomow commented Apr 21, 2021

Describe the bug
When running samples/net/sockets/packet the reception stops working after about 14 packets were received.

To Reproduce
Steps to reproduce the behavior:

  1. west build -b native_posix_64 zephyr/samples/net/sockets/packet
  2. On one terminal, run sudo ./net-setup.sh from the net-tools repo.
  3. On the first terminal, type west build -t run.
  4. Start sending packets to zeth interface (I used ping).

Expected behavior
All the packets are received correctly, and the print log net_pkt_sock_sample.recv_packet_socket: Received is printed for every packet.

Logs and console output

UART_0 connected to pseudotty: /dev/pts/4
WARNING: Using a test - not safe - entropy source
*** Booting Zephyr OS build zephyr-v2.5.0-2383-gf59cba331553  ***
[00:00:00.000,000] <inf> net_pkt_sock_sample: Packet socket sample is running
[00:00:00.000,000] <inf> net_pkt_sock_sample: Waiting for packets ...
[00:00:00.060,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 130 bytes
[00:00:00.960,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 130 bytes
[00:00:05.010,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:10.020,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:15.030,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:20.040,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:25.050,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:25.620,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 213 bytes
[00:00:26.640,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 213 bytes
[00:00:27.660,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 213 bytes
[00:00:28.680,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 213 bytes
[00:00:30.060,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:35.070,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:40.080,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:45.090,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:50.100,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:00:55.110,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:00.120,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:05.130,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:10.140,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:15.150,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:17.520,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 70 bytes
[00:01:20.160,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:25.170,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:30.180,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:32.220,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:33.300,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:34.320,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:35.190,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:35.340,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:36.360,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:37.380,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:38.400,000] <dbg> net_pkt_sock_sample.recv_packet_socket: Received 42 bytes
[00:01:39.530,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:40.200,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:40.550,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:41.570,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:42.590,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:43.610,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:45.210,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:50.220,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:53.270,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:54.290,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:55.230,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:01:55.310,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:56.330,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:57.350,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:01:58.370,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:02:00.240,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:05.250,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:10.260,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:15.270,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:20.280,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:25.290,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:25.730,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:02:26.750,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:02:27.770,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:02:28.790,000] <wrn> net_conn: pkt cloning failed, pkt 0x5645dbd534a0 dropped
[00:02:30.300,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:35.310,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:40.320,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:45.330,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:50.340,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:02:55.350,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:00.360,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:05.370,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:10.380,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:15.390,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:20.400,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:25.410,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:30.420,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes
[00:03:35.430,000] <dbg> net_pkt_sock_sample.send_packet_socket: Sent 100 bytes

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Toolchain: Zephyr SDK 0.11.4
  • Commit SHA: f59cba331553be094c23f1fb2839e76c403f6bfc (19.4.2021)
@shlomow shlomow added the bug The issue is a bug, or the PR is fixing a bug label Apr 21, 2021
jukkar added a commit to jukkar/zephyr that referenced this issue Apr 23, 2021
The conn_raw_input() in connection.c will clone the incoming
packet so that it is possible to receive socket data in
multiple packet sockets. This is all fine except that if the
socket is never calling recv(), then the cloned net_pkt is never
processed and we will have a memory leak.

What this all means in practice, is that we should call recv()
for every packet socket in order to flush the socket for any
incoming data even if the socket is just sending data.

Fixes zephyrproject-rtos#34462

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
MaureenHelm pushed a commit that referenced this issue Apr 23, 2021
The conn_raw_input() in connection.c will clone the incoming
packet so that it is possible to receive socket data in
multiple packet sockets. This is all fine except that if the
socket is never calling recv(), then the cloned net_pkt is never
processed and we will have a memory leak.

What this all means in practice, is that we should call recv()
for every packet socket in order to flush the socket for any
incoming data even if the socket is just sending data.

Fixes #34462

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants