Open OlivierNicole opened 4 months ago
Something strange showed up in ThreadSanitizer logs: in Lwt_unix, more precisely in lwt_unix_start_job, the thread_waiting_count variable is written with the pool mutex taken:
Lwt_unix
lwt_unix_start_job
thread_waiting_count
https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L1002-L1010
This happens on the worker thread.
However, it can be read by the main thread without locking any mutexes:
https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L1061-L1069
This looks like a genuine data race.
Similarly TSan reports unsynchronised read and write between:
https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L912-L918
and
https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L1126
Something strange showed up in ThreadSanitizer logs: in
Lwt_unix
, more precisely inlwt_unix_start_job
, thethread_waiting_count
variable is written with the pool mutex taken:https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L1002-L1010
This happens on the worker thread.
However, it can be read by the main thread without locking any mutexes:
https://github.com/ocsigen/lwt/blob/68cf601f5d0250a0193e7f0c7af5a65eb39f32c9/src/unix/lwt_unix_stubs.c#L1061-L1069
This looks like a genuine data race.