ywkaras commented on issue #10129:
URL: 
https://github.com/apache/trafficserver/issues/10129#issuecomment-1662839243

   I think a general description of the problem scenario is:
   
   1. While it has a mutex M locked, a function F makes a call that can trigger 
the dynamic loading of a shared library S1.
   2. F is called during the non-local dynamic initialization of another shared 
library S2.  It appears to be the case that the runtime has an implicit mutex 
MS, which is locked during while any shared library is dynamically loaded.  It 
seems MS is kept locked during the non-local initialization of the library 
being loaded.
   3. F is also called from the core executable, and there is a race condition 
between this/these calls for F, and the loading of S2.
   
   The deadlock scenario is:
   
   1. Thread T1 locks MS, starts loading S2, and calls F.
   2. Thread T2 calls F, and locks M.  T2 then blocks on MS, because it needs 
to load S1.
   3. T1, within its call to F, blocks on M.  Deadlock.
   
   One possible solution is to trigger the loading of S1 during initialization 
while there is still just one thread.  But this will only work if the dynamic 
loader checks if a library is loaded without locking MS, and only locks it if 
it loading the library is necessary.
   
   There may be tricky ways for avoid calling PCRE functions during non-local 
dynamic initialization.  But, ew.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to