[Gc] Signals / EINTR loop

Nicolas Cannasse ncannasse at motion-twin.com
Wed Aug 6 07:55:41 PDT 2008


Hello,

We are using the GC 7.1 as part of a multithread network server (on 
Linux/pthreads). One thread simply wait for accept() and then dispatch 
the socket among several working threads.

Sometimes, in a call to recv(), the function returns with -1 and errno 
is EINTR. This is normal since the GC might have tried to pause the 
thread when collecting. We are then simply looping in order to restart 
the recv() again.

The problem is that after that, each next call to recv() immediatly 
returns with -1 + EINTR again, so we are entering an infinite loop that 
takes full CPU (shared between User and System).

Is it a known problem ? Is there any way to check what's happening there 
? Reading in the mailing list archives, I found 
GC_start_blocking/GC_end_blocking that would be helpful but they do not 
seems to be available anymore as part of the LibGC 7.1

PS : other threads are blocked in pthread_cond_wait, in case this might 
be related to the problem.

PPS : we had a timeout set on the socket using setsockopt(SO_RCVTIMEO) 
but removing it doesn't seems to fix the problem.

Best,
Nicolas Cannasse
Motion-Twin



More information about the Gc mailing list