Обсуждение: libpq @windows : leaked singlethread_lock makes AppVerifier unhappy

Поиск
Список
Период
Сортировка

libpq @windows : leaked singlethread_lock makes AppVerifier unhappy

От
Першин Юрий Петрович
Дата:

HI

 

    address d2be8fe8 found in

    _DPH_HEAP_ROOT @ fe321000

    in busy allocation (  DPH_HEAP_BLOCK:         UserAddr         UserSize -         VirtAddr         VirtSize)

                                d2dd3444:         d2be8fe8               18 -         d2be8000             2000

    576bab70 verifier!AVrfDebugPageHeapAllocate+0x00000240

    77aa909b ntdll!RtlDebugAllocateHeap+0x00000039

    779fbbad ntdll!RtlpAllocateHeap+0x000000ed

    779fb0cf ntdll!RtlpAllocateHeapInternal+0x0000022f

    779fae8e ntdll!RtlAllocateHeap+0x0000003e

    5778aa2f vrfcore!VfCoreRtlAllocateHeap+0x0000001f

    56b5256c vfbasics!AVrfpRtlAllocateHeap+0x000000dc

    7558a9f6 ucrtbase!_malloc_base+0x00000026

    56b538b8 vfbasics!AVrfp_ucrt_malloc+0x00000038

*** WARNING: Unable to verify checksum for C:\Program Files (x86)\psqlODBC\1300\bin\LIBPQ.dll

    d2d973ab LIBPQ!appendBinaryPQExpBuffer+0x0000016b

    d2d855f3 LIBPQ!PQpingParams+0x000002a3

    d2d82406 LIBPQ!PQencryptPasswordConn+0x00000346

    d2d83c0d LIBPQ!PQconnectPoll+0x00000c4d

    d2d85822 LIBPQ!PQpingParams+0x000004d2

    d2d8463a LIBPQ!PQconnectdbParams+0x0000002a

*** WARNING: Unable to verify checksum for C:\Program Files (x86)\psqlODBC\1300\bin\psqlodbc35w.dll

    51798c6c psqlodbc35w!LIBPQ_connect+0x0000051c [c:\mingw\git\psqlodbc-13.00.0000\connection.c @ 2879]

    51795701 psqlodbc35w!CC_connect+0x000000c1 [c:\mingw\git\psqlodbc-13.00.0000\connection.c @ 1110]

    517ac698 psqlodbc35w!PGAPI_DriverConnect+0x000002f8 [c:\mingw\git\psqlodbc-13.00.0000\drvconn.c @ 233]

    517c3bad psqlodbc35w!SQLDriverConnectW+0x0000016d [c:\mingw\git\psqlodbc-13.00.0000\odbcapiw.c @ 163]

    6f7733dc ODBC32!SQLInternalDriverConnectW+0x0000014c

    6f770fb0 ODBC32!SQLDriverConnectW+0x00000ac0

    535d2a4a msdasql!CODBCHandle::OHDriverConnect+0x000000da

    535c554c msdasql!CImpIDBInitialize::Initialize+0x000002ec

    519c079a oledb32!CDBInitialize::DoInitialize+0x0000003b

    519beaa4 oledb32!CDBInitialize::Initialize+0x00000034

    519c0d12 oledb32!CDCMPool::CreateResource+0x00000162

    51873f3b comsvcs!CHolder::SafeDispenserDriver::CreateResource+0x0000005b

    51871c5e comsvcs!CHolder::AllocResource+0x000001fe

    519bb6da oledb32!CDCMPool::DrawResource+0x0000014a

    519bb24b oledb32!CDCMPoolManager::DrawResource+0x0000020b

    519b8233 oledb32!CDPO::Initialize+0x00000263

    51a993ab msado15!_ConnectAsync+0x000001ab

 

RE: libpq @windows : leaked singlethread_lock makes AppVerifier unhappy

От
Першин Юрий Петрович
Дата:

Hi
Here is my workaround (from unit_tests.dll DLL_PROCESS_DETACH):

 

            //3. Destroy LIBPQ!static pthread_mutex_t singlethread_lock

-                              327                     HMODULE hLeakedLibPQ = ::GetModuleHandleA("libpq.dll"); //libpq.dll v13.0.1.20323 (https://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc_13_00_0000.zip)

-                              328                     if (hLeakedLibPQ) {

-                              329                         void **singlethread_lock_ptr = (void **)(((BYTE *)hLeakedLibPQ) +

-                              330         #ifdef _WIN64

-                              331                             0x484b8

-                              332         #else

-                              333                             0x3F26C

-                              334         #endif //_WIN64

-                              335                             );

-                              336                         if (*singlethread_lock_ptr) {

-                              337                             DeleteCriticalSection((LPCRITICAL_SECTION)(*singlethread_lock_ptr));

-                              338                             typedef void(*pthread_mutex_destroy)(void *mutex);

-                              339                             pthread_mutex_destroy freemtx = (pthread_mutex_destroy)::GetProcAddress(hLeakedLibPQ, "PQfreemem");

-                              340                             assert(freemtx != NULL);

-                              341                             if (freemtx) freemtx(*singlethread_lock_ptr);

-                              342                         }

-                              343                     }