Socket accept doesn't answer

Hello,

I have a C++ application server (g++49) . It accepts connections :beer! It works fairly nicely (uptime for days with normal usage :stud ). It runs four threads for doing jobs and one for accepting connections and dispatching jobs. Actually it runs on Linux, OpenBSD and FreeBSD. Nevertheless, under high load the programs encounters a case where it is eating 100% CPU:
Code:
$ ps auxwww | grep myserver
root    93321 100.0  0.2  23184   4676 ??  Ss    8:52PM      8:17.43 /usr/local/bin/myserver
So I killed it with -8 and looked (I was looking for the bug, so I have the symbols):
Code:
(gdb) info threads
  Id   Target Id         Frame
  5    process 107731    0x00000000004aca1c in __sys_accept ()
  4    process 105294    0x00000000004acbdc in __sys_poll ()
  3    process 106603    0x00000000004acbdc in __sys_poll ()
  2    process 107746    0x00000000004acbdc in __sys_poll ()
* 1    process 107747    0x00000000004acbdc in __sys_poll ()
All the syspolls are legit , but why am I blocked into __sys_accept()? I am running FreeBSD 9.1-RELEASE. Connections comes always from localhost. I poll/select it before calling accept, with libevent2 event_assign: EV_READ | EV_PERSIST

What information should I look at next when I will lock it like this again? (kernel) guru help much welcomed!

yes the socket is non blocking :
Code:
  int flags = fcntl(socket,F_GETFL,0);
  fcntl(socket, F_SETFL, flags | O_NONBLOCK);

Best regards.
 
Back
Top