** Also affects: lmbench (Ubuntu Zesty)
   Importance: Undecided
       Status: New

** Also affects: lmbench (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: lmbench (Ubuntu Xenial)
       Status: New => In Progress

** Changed in: lmbench (Ubuntu Xenial)
     Assignee: (unassigned) => dann frazier (dannf)

** Changed in: lmbench (Ubuntu Zesty)
     Assignee: (unassigned) => dann frazier (dannf)

** Changed in: lmbench (Ubuntu Zesty)
       Status: New => In Progress

** Description changed:

+ [Impact]
+ Network related tests will hang on high-core count systems.
+ 
  lib_tcp reserves backlog of 100. If there are more then 100 threads on
  the system, the backlog is pretty much guaranteed to fail. The clients
  will then fail to connect and lmbench will hang. Potential patch below
  works around this by reserving backlog for at least 4x number of
  processors reported in the system, assuming that common use case will be
  to run lmbench with as many threads as there are cpus reported from the
  OS. Alternatively, backlog reservation can be made into a config option.
  
- How to repeat:
- Run lmbench on a system with >100 threads.
+ [Test Case]
+ ubuntu@ubuntu:~$ /usr/lib/lmbench/bin/lat_select -P 128 tcp
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
+ connect: Connection timed out
  
- Potential patch:
+ With the patch:
+ ubuntu@ubuntu:~/lmbench$ /usr/lib/lmbench/bin/lat_select -P 128 tcpSelect on 
200 tcp fd's:
+ XX.XXXX microseconds
  
- --- src/lib_tcp.old     2017-07-18 00:13:43.312112975 +0000
- +++ src/lib_tcp.c       2017-07-18 00:13:27.072026975 +0000
- @@ -7,7 +7,7 @@
-   */
- #define                _LIB /* bench.h needs this */
- #include       "bench.h"
- -
- +#include <unistd.h>
- /*
-   * Get a TCP socket, bind it, figure out the port,
-   * and advertise the port as program "prog".
- @@ -17,7 +17,7 @@
- int
- tcp_server(int prog, int rdwr)
- {
- -       int     sock;
- +       int     sock,np,backlog;
-         struct  sockaddr_in s;
- 
- #ifdef LIBTCP_VERBOSE
- @@ -37,7 +37,11 @@
-                 perror("bind");
-                 exit(2);
-         }
- -       if (listen(sock, 100) < 0) {
- +       /* rather than use a set backlog, use at least 4x of the number of 
cores exposed by the OS if needed for modern many core systems */
- +       np=sysconf(_SC_NPROCESSORS_ONLN);
- +       if (np * 4 > backlog)
- +               backlog = np*4;
- +       if (listen(sock, backlog) < 0) {
-                 perror("listen");
-                 exit(4);
-         }
+ [Regression Risk]
+ The patch is careful to preserve the previous behavior for lower core count 
systems. Perhaps if there were a bug in the platform's 
sysconf(_SC_NPROCESSORS_ONLN) function, we could end up with a regression that 
skewed results.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1706735

Title:
  lmbench tcp lib backlog reservation too small, can cause hang.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lmbench/+bug/1706735/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to