[AGENT++] uxsnmp

Straus, Richard Richard.Straus at nuance.com
Thu May 7 17:05:46 CEST 2015


Hi,

We have encountered a crash in the Snmp::stop_poll_thread() call. This crash includes the latest version of snmp++ 3.3.5.

We have determined the issue to be caused by WaitForSingleObject call:

#ifdef WIN32
    ::WaitForSingleObject(m_hThreadEndEvent, INFINITE);
    CloseHandle(m_hThread);

The SNMP calls are made in a DLL that is loaded and then unloaded. The problem is the thread keeps running for a brief period of time after setting m_hThreadEndEvent and during that time, the DLL unload sometimes completes - taking away the object code from the still-executing thread.

We have been able to resolve the issue for WIN32 by removing all code referring to m_hThreadEndEvent. That means deleting the CreateEvent, SetEvent, ResetEvent calls pertaining to m_hThreadEndEvent as they are unnecessary. The above code in stop_poll_thread() is then replaced with this code:

#ifdef WIN32
                if (NULL != m_hThread && INVALID_HANDLE_VALUE != m_hThread)
                {
                                ::WaitForSingleObject(m_hThread, INFINITE);
                                CloseHandle(m_hThread);
                                m_hThread = NULL;
                }

Regards

Richard Straus
Senior Software Developer
Equitrac MFP and Print Management Solutions
Nuance Communications



More information about the AGENTPP mailing list