EventWaitHandle Errors RRS feed

  • Question

  • Hello,

    We are getting following exception on few environments while calling the System.Threading.WaitHandle.WaitOne(500, false).

    System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
       at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
       at System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
       at System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext)
    Also we are seeing below exception in similar circumstances when System.Threading.EventWaitHandle.Set() and Reset() methods are being called. Most of the time we see the issue with ManualResetEvent.Set() but sometimes it has occurred with ManualResetEvent.Reset() and AutoResetEvent.Set() also. The issue occurred on both "Win XP Professional SP3" and "Win 7 Enterprise SP1 - 64 bit" environments.

    System.IO.IOException: The handle is invalid.
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.__Error.WinIOError()
       at System.Threading.EventWaitHandle.Set()

    Above issues are not reproducible on the development environment but we are seeing these errors in the log file on some of our QA environments periodically.

    Any help or guidance is highly appreciated, please let me know if any additional information is required.

    Narendra Chavda

    Tuesday, November 12, 2013 5:11 PM


  • Hi Narendra,

    I found that error “Access is denied (0X80070005)”, which seems to be a permission issue. Microsoft has provided a solution center for Access Denied Error Messages, please refer to this below page to see more information.

    For your second question, I don’t know why ManualResetEvent.Set method can throw IOException? I think you should use WinDBG to collect more error information about this issue. If possible, please add the try-catch code block into your thread code and log the error message.

    Hope useful to you.

    Best Regards,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 13, 2013 7:14 AM