Hi Sergey
Thank you for your reply. Yes, the timer is asynchronously, otherwise we don’t see any problems. This deadlock happens more often, the smaller the timeout (signal handler is called more often) and the slower the computer (memory allocation takes longer). Both increase the probability of an asynchronous signal handler being called during a malloc()
.
The problem is that when a timeout happens, THttpServer::ProcessRequests()
is called:
This in turn calls TThread::SelfId()
, which in turn calls TThread::Init()
and finally TPosixThreadFactory::CreateThreadImp()
, which calls new
, which calls malloc()
:
Since malloc()
is not async-signal-safe, either the timeout function must not be allowed to call THttpServer::ProcessRequests()
, or the timer must not be asynchronous. Since you want to keep the functionality of ProcessRequests()
, I think you should not allow an asynchronous timer here.
That is my understanding of the situation. Please let me know if you think my logic is flawed.