Does ManualResetEvent.WaitOne () return false without a timeout?

What would lead to a return ManualResetEvent.WaitOne() falseother than a timeout?

We have a call WaitOne(3600000)that returns in about five minutes with false.

This behavior is observed only on one server out of about 300. We have not yet identified anything special in this particular server. The call is in a Windows service using .NET 4.0.

The code in which we use the call looks basically like this:

 if (tracker.WaitOne(timeout)) {
     Log("Success");
     return;
 }
 Log("Timed out");
 throw new Exception(...);

We get Timed out logs after about five minutes (not really).

Please note that the timeout is usually not one hour. We extended the timeout for testing, as it exited earlier than expected. Typically, the timeout is set to ten minutes. In the vast majority of runs, the tracker is less than Set()less than a second, although it rarely can take several minutes.

I also looked to see if anyone could recycle the wait descriptor, but the only place it is after it is installed. I also checked if recycling would be closed after the set could cause the wait descriptor to return incorrectly, and in my tests on .NET 4 and .NET 4.5 the wait command always returned true, even when dispose is called immediately after the set.

+4
source share
1 answer

(5 60), , - .

, false, - (, - , "", "" ) - , - , , .

+2

All Articles