Skip to content

Commit 2316ea9

Browse files
glyhdannywillems
authored andcommitted
Note on why we're not calling LMDB in GC hooks
1 parent 3404272 commit 2316ea9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/disk_cache/lmdb/disk_cache.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ module Make (Data : Binable.S) = struct
5353
let res = { idx } in
5454
(* When this reference is GC'd, delete the file. *)
5555
Gc.Expert.add_finalizer_last_exn res (fun () ->
56+
(* The actual deletion is delayed, as GC maybe triggered in LMDB's
57+
critical section. LMDB critical section then will be re-entered if
58+
it's invoked directly in a GC hook.
59+
This causes mutex double-acquiring and node freezes. *)
5660
[%log debug] "Data at %d is GCed, marking as garbage" idx
5761
~metadata:[ ("index", `Int idx) ] ;
5862
Hash_set.add garbage idx ) ;

0 commit comments

Comments
 (0)