<html>
<head>
<base href="https://bugs.dpdk.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - testpmd: early exit with tap driver in non interactive mode"
href="https://bugs.dpdk.org/show_bug.cgi?id=1305">1305</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>testpmd: early exit with tap driver in non interactive mode
</td>
</tr>
<tr>
<th>Product</th>
<td>DPDK
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>Normal
</td>
</tr>
<tr>
<th>Component</th>
<td>testpmd
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dev@dpdk.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.marchand@redhat.com
</td>
</tr>
<tr>
<th>Target Milestone</th>
<td>---
</td>
</tr></table>
<p>
<div class="bz_comment_block">
<pre class="bz_comment_text">Reported by Frode, while running OVS-DPDK unit tests.
testpmd behavior changed with commit 0fd1386c30c3 ("app/testpmd: cleanup
cleanly from signal"). Any signal makes testpmd quit.
This can be problematic with the tap driver which uses internal signalling.
Reproducer with strace to illustrate the issue:
$ sudo strace -f -e trace=file build-clang/app/dpdk-testpmd -c 3 --no-huge -m
40 -a 0:0.0 --vdev net_tap0 -- --no-mlockall --total-num-mbufs=2048 -a
...
No commandline core given, start packet forwarding
io packet forwarding - ports=1 - cores=1 - streams=1 - NUMA support enabled, MP
allocation mode: native
Logical Core 1 (socket 0) forwards packets on 1 streams:
RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
[pid 3780703] --- SIGRT_3 {si_signo=SIGRT_3, si_code=0x1, si_pid=65, si_uid=0,
si_int=22, si_ptr=0x16} ---
io packet forwarding packets/burst=32
nb forwarding cores=1 - nb forwarding ports=1
port 0: RX queue number: 1 Tx queue number: 1
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=0 - RX free threshold=0
RX threshold registers: pthresh=0 hthresh=0 wthresh=0
RX Offloads=0x0
TX queue: 0
TX desc=0 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
Press enter to exit
[pid 3780703] --- SIGRT_3 {si_signo=SIGRT_3, si_code=0x1, si_pid=65, si_uid=0,
si_int=22, si_ptr=0x16} ---
Telling cores to stop...
Waiting for lcores to finish...
---------------------- Forward statistics for port 0 ----------------------
RX-packets: 1 RX-dropped: 0 RX-total: 1
TX-packets: 1 TX-dropped: 0 TX-total: 1
----------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
RX-packets: 1 RX-dropped: 0 RX-total: 1
TX-packets: 1 TX-dropped: 0 TX-total: 1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Done.
Stopping port 0...
Stopping ports...
Done
Shutting down port 0...
Closing ports...
Port 0 is closed
Done
Bye...
[pid 3780705] --- SIGRTMIN {si_signo=SIGRTMIN, si_code=SI_TKILL,
si_pid=3780703, si_uid=0} ---
[pid 3780705] +++ exited with 0 +++
[pid 3780703] unlink("/var/run/dpdk/rte/mp_socket") = 0
[pid 3780703] unlink("/var/run/dpdk/rte/dpdk_telemetry.v2:1") = 0
==3780703==LeakSanitizer has encountered a fatal error.
==3780703==HINT: For debugging, try setting environment variable
LSAN_OPTIONS=verbosity=1:log_threads=1
==3780703==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
[pid 3780710] +++ exited with 1 +++
[pid 3780704] +++ exited with 1 +++
[pid 3780706] +++ exited with 1 +++
+++ exited with 1 +++
A quick fix I tried:
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 595b77748c..57d257623e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4743,22 +4743,11 @@ main(int argc, char** argv)
}
} else {
char c;
- fd_set fds;
printf("Press enter to exit\n");
- FD_ZERO(&fds);
- FD_SET(0, &fds);
-
- /* wait for signal or enter */
- ret = select(1, &fds, NULL, NULL, NULL);
- if (ret < 0 && errno != EINTR)
- rte_exit(EXIT_FAILURE,
- "Select failed: %s\n",
- strerror(errno));
-
/* if got enter then consume it */
- if (ret == 1 && read(0, &c, 1) < 0)
+ if (read(0, &c, 1) < 0 && errno != EINTR)
rte_exit(EXIT_FAILURE,
"Read failed: %s\n",
strerror(errno));
</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1305">
<meta itemprop="name" content="View bug">
</div>
<meta itemprop="description" content="Bugzilla bug update notification">
</div>
</body>
</html>