and is accessed in parallel both by flexdll_*dlopen and flexdll_dlsym without using a lock. Adding locks around flexdll_*dlopen is straightforward, but symbol lookup operates a most-recently-used queue on the global, and the performance impact either of removing that or, worse, of putting a lock around flexdll_dlsym is less clear.
In the meantime, reverting ocaml/ocaml#11607 provides an easy test-case for demonstrating the failure (the test usually fails within a few runs)
The list of loaded units is defined globally in
flexdll.c
: https://github.com/ocaml/flexdll/blob/cc0525e99e7109c8d3206085759185bd733ac49f/flexdll.c#L417and is accessed in parallel both by
flexdll_*dlopen
andflexdll_dlsym
without using a lock. Adding locks aroundflexdll_*dlopen
is straightforward, but symbol lookup operates a most-recently-used queue on the global, and the performance impact either of removing that or, worse, of putting a lock aroundflexdll_dlsym
is less clear.In the meantime, reverting ocaml/ocaml#11607 provides an easy test-case for demonstrating the failure (the test usually fails within a few runs)