[Gc] Signals / EINTR loop

Hans Boehm Hans.Boehm at hp.com
Wed Aug 6 17:19:43 PDT 2008

You might try using GC_do_blocking() (pthreads only).


On Wed, 6 Aug 2008, Nicolas Cannasse wrote:

> 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
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list