[PATCH] Fix a pthreadpool race

Ralph Wuerthner ralphw at de.ibm.com
Fri Dec 15 15:57:39 UTC 2017


On 15.12.2017 12:54, Volker Lendecke wrote:
> That is of course a lot more elegant. Looking through the code I have
> one concern: The threads are kept busy throughout the fork, which is
> good. I would like to see a good argument why the while(num_idle!=0)
> loop in pthreadpool_prepare_pool deterministically terminates. It's
> probably not really supported right now, but what if a helper thread
> creates new jobs? This might keep the helper threads busy, and they
> might re-enter idle state over and over again when prepare_pool checks
> for idle threads. More parallelism is good, your patch is of course
> simpler and thus preferrable, but I would feel better if we had a
> "proof" that prepare_pool never runs into an endless loop. Keep in
> mind that every single small race we open will eventually be hit at a
> customer installation :-)

I see, this is a valid concern. Let me check if I can harden the code to 
guarantee that pthreadpool_prepare_pool will not end in an endless loop.

-- 
Regards

    Ralph Wuerthner




More information about the samba-technical mailing list