Hello,
I have a socket program that is running flawlessly under Solaris.
When I re-compiled it under Linux (CentOS 5.1) and run it, I got the
following error:
recv() failed: Interrupted system call
This only occurs very infrequently (probably one out of a million
packets exchanged).
select() in my program is getting EINTR.
From the postings I found in the news group seem suggesting that it is
due to GC.
The GC sends signals to each thread which causes them all to enter a stop-the-world state. When the GC
is finished, all the threads are resumed. When the threads are resumed, any that were blocked in a
blocking system call (like poll()) will return with EINTR. Normally you would just retry the system call.
So, I added to check if the errno == EINTR and now my program seems
working fine.
//
My question I would like to ask in this group is:
Does this mean any system call under Linux could return empty-hand
with EINTR due to GC?
I usually assume fatal if system call returns -1.
It is quite painful to check all system-call return status.
My second question is:
Does this can occur in other OS's? (free-BSD, Solaris, ...)
Or, is this specific to Linux OS?