-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
With the new MongoC_jll version 1.28.1+0 we observe applications crashing at exit with the following stacktrace:
/workspace/srcdir/mongo-c-driver/src/libmongoc/src/mongoc/mongoc-handshake.c:729 _mongoc_handshake_freeze(): precondition failed: pthread_mutex_lock ((&gHandshakeLock)) == 0
[426066] signal (6.-6): Aborted
in expression starting at none:0
pthread_kill at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
raise at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_mongoc_handshake_freeze at /home/christian/.julia/artifacts/ccbf834dee3ed4a30ecdf325bb44fd35c7a379fd/lib/libmongoc-1.0.so (unknown line)
_mongoc_topology_do_blocking_scan at /home/christian/.julia/artifacts/ccbf834dee3ed4a30ecdf325bb44fd35c7a379fd/lib/libmongoc-1.0.so (unknown line)
mongoc_topology_select_server_id at /home/christian/.julia/artifacts/ccbf834dee3ed4a30ecdf325bb44fd35c7a379fd/lib/libmongoc-1.0.so (unknown line)
_mongoc_client_end_sessions at /home/christian/.julia/artifacts/ccbf834dee3ed4a30ecdf325bb44fd35c7a379fd/lib/libmongoc-1.0.so (unknown line)
mongoc_client_destroy at /home/christian/.julia/artifacts/ccbf834dee3ed4a30ecdf325bb44fd35c7a379fd/lib/libmongoc-1.0.so (unknown line)
mongoc_client_destroy at /home/christian/.julia/packages/Mongoc/H1UAz/src/c_api.jl:391 [inlined]
destroy! at /home/christian/.julia/packages/Mongoc/H1UAz/src/types.jl:290
unknown function (ip: 0x70a72113f0f5)
_jl_invoke at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/gf.c:2895 [inlined]
ijl_apply_generic at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/gf.c:3077
run_finalizer at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/gc.c:318
jl_gc_run_finalizers_in_list at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/gc.c:408
run_finalizers at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/gc.c:454
ijl_atexit_hook at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/init.c:299
jl_repl_entrypoint at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/src/jlapi.c:732
main at /cache/build/builder-amdci5-5/julialang/julia-release-1-dot-10/cli/loader_exe.c:58
unknown function (ip: 0x70a73ac29d8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
Allocations: 159359804 (Pool: 159281192; Big: 78612); GC: 58
Aborted (core dumped)
The MongoC change that's triggering this crash is this: mongodb/mongo-c-driver@63b780e and the underlying reason is that gHandshakeLock is destroyed from mongoc_cleanup.
The reason is that mongoc_client_destroy is called from a finalizer (here) which can be called after mongoc_cleanup is called from atexit() hook (here).
The current workaround is to explicitly destroy!() all Mongoc.Client objects before that atexit hook is called. But I assume there should be a better fix available.
Metadata
Metadata
Assignees
Labels
No labels