-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Our application uses multi-threaded compression with default compression level (3) and sets nbWorkers to number of logical cores on the machine. We create the compression context on first use and reuse it throughout the session and free it on termination. All our compression calls are issued from the main thread only.
We're getting crash reports from the field that some users are encountering a crash in the main thread during this cleanup inside the function POOL_join, in the second call to ZSTD_pthread_cond_broadcast (WakeAllConditionVariable on Windows). We haven't been able to find steps to reproduce this problem.
Crash stack from the dump looks like the following:
ntdll.dll!00007ffcd1b6cc37() Unknown
[Inline Frame] AppName.exe!POOL_join(POOL_ctx_s *) Line 168 C
AppName.exe!POOL_free(POOL_ctx_s * ctx) Line 178 C
AppName.exe!ZSTDMT_freeCCtx(ZSTDMT_CCtx_s * mtctx) Line 966 C
AppName.exe!ZSTD_freeCCtxContent(ZSTD_CCtx_s * cctx) Line 138 C
AppName.exe!ZSTD_freeCCtx(ZSTD_CCtx_s * cctx) Line 149 C
We can't share the dump files due to legal and privacy concerns but following are the debugger views of the source and disassembly of the main and pool thread.
We are on zstd release 1.4.4 and using Visual Studio 2017 (15.9) on Windows and building for x86_64.
An observation that has been true for all dumps we've examined so far, is that some of the pool threads seem to have exited by the time the crash happens.
For example, in the above dump, nbWorkers was set as 4 but at the time of the crash only one pool thread was still active. Rest 3 had exited.
Any insights on how to resolve this would be highly appreciated. Thanks.



