Public bug reported: 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. Potential patch: --- 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); } ** Affects: lmbench (Ubuntu) Importance: Undecided Status: New -- 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 ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs