Ticket 50389 - ns-slapd craches while two threads are polling the same connection
Bug Description:
nspr IO is not multi-threaded safe.
389-ds should not be in a situation where several threads are polling
a same connection at the same time.
The scenario is a worker send back an operation result at the same time
another worker wants to read an incoming request.
Fix Description:
The fix consist in synchonizing polling with c_pdumutex.
The thread that sends data (flush_ber) hold c_pdumutex.
The thread that reads the data does a non blocking read. It then
enforce ioblocktimeout with iteration of poll.
The reading thread must hold c_pdumutex during poll to synchronize
with the reader thread.
The reading thread must poll with a small timeout
(CONN_TURBO_TIMEOUT_INTERVAL). In order to not block
the thread that send back data, the fix reduces the delay to 0.1s.
https://pagure.io/389-ds-base/issue/50389
Reviewed by: Mark Reynolds, Matus Honek, William Brown
Platforms tested: F28
Flag Day: no
Doc impact: no
(cherry picked from commit 2886ba77f664e4734a7ddfe4146f229caca49ce4)