Forum Navigation
Unexpected rare SyncExceptions from Condition.wait
Posted: 01/07/10 07:28:28 Modified: 01/07/10 07:28:48In a program under linux using tango.core.sync.Conditions very rarely I'm getting a SyncException? with the message "Unable to wait for condition". Looking at the code I see this can come from either the indefinite wait or time out wait. I added some logging so I could tell which method was throwing the error and what the actual return code was from the pthread function. So far in about an 18 hour run I have two errors thrown by Condition.wait(timeout) with the error from pthread_cond_timedwait being EINVAL(22). The code where it's being thrown just looks like:
synchronized (lock) { condition.wait(0.1); }I'm positive the condition isn't being used with another lock and as you can see the lock should be held when wait is called. From the pthread documentation it looks like the only other reason for EINVAL is if the time passed in is invalid. So my guess at this point is that adjTimespec in tango.core.sync.Config is running into a rare overflow that is causing a negative tv_nsec. I'll go ahead and add some more logging to try and check that but any other ideas would be welcome.