[PATCHES][BUG 13170] Fix crash in pthreadpool thread after failure from pthread_create

Andreas Schneider asn at samba.org
Mon Dec 4 12:33:20 UTC 2017


On Thursday, 30 November 2017 20:14:35 CET Christof Schmitt via samba-
technical wrote:
> On Thu, Nov 30, 2017 at 01:40:00PM +0100, Volker Lendecke wrote:
> > On Wed, Nov 29, 2017 at 12:23:34PM -0700, Christof Schmitt via samba-
technical wrote:
> > > As discussed in a side-thread, my initial patch lets the error surface
> > > back to the client. Here is an updated patch that avoids this issue. If
> > > no thread can be created, but another still exists, let that handle the
> > > request. If no thread exists, then fallback to processing the job
> > > synchronously, as the system might be hitting a resource limit.
> > 
> > From a review perspective, this looks good. For the refactoring one of
> > course RB+. However, pthreadpool being such a fragile piece of code I
> > would love to see unit tests for this.  This will require explicit
> > error injects with some DEVELOPER only code, but is it possible to get
> > this? If you don't have time, I might try to code something up.
> 
> Yes, see attached patch. I am not sure if that is the best solution, but
> it is easy enough. A more complicate approach would be LD_PRELOAD to
> overwrite the libc functions.

Use mocking support from cmocka to mock pthreadpool_create_thread()?


See https://lwn.net/Articles/558106/



	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list