weird AV in RunPrivateStateThread.

For some projets I get a weird access violation in this function:

Process::RunPrivateStateThread ()

these lines:
EventSP event_sp;
WaitForEventsPrivate (NULL, event_sp, control_only);
if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster)) <<<

at this point event_sp contains a NULL pointer and thus fails. What could cause this and should there be a check for the result type of WaitForEventsPrivate?

Carlo Kok

Sounds like there may be a race or shutdown condition or some other way that WaitForEventsPrivate () is returning false and not filling in an event.

You can place do:

if (WaitForEventsPrivate (NULL, event_sp, control_only))
{
    ...
}
else
{
    ... log an error that we expected to get something, or maybe call "break;"???
}

If this is happening on shutdown, it might be expected. If this is happening while running, we really need to figure out why we aren't getting an event (again, race condition? shutdown flow error?)

Op 9-11-2012 19:00, Greg Clayton schreef:

Sounds like there may be a race or shutdown condition or some other way that WaitForEventsPrivate () is returning false and not filling in an event.

You can place do:

if (WaitForEventsPrivate (NULL, event_sp, control_only))
{
     ...
}
else
{
     ... log an error that we expected to get something, or maybe call "break;"???
}

If this is happening on shutdown, it might be expected. If this is happening while running, we really need to figure out why we aren't getting an event (again, race condition? shutdown flow error?)

It wasn't on shutdown. I did add the "break" and enabled logging, however the act of enabling logging stopped the issue from showing at all.