Author ronaldoussoren
Recipients ned.deily, ronaldoussoren
Date 2015-12-22.12:57:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450789030.99.0.515103781608.issue25924@psf.upfronthosting.co.za>
In-reply-to
Content
https://emptysqua.re/blog/getaddrinfo-deadlock/ claims that getaddrinfo may deadlock when using threads and fork on (amongst others) OSX due to using a global lock.

That lock is used when getaddrinfo is believed to be not thread safe, see the relevant code below (from the blog post):

/* On systems on which getaddrinfo() is believed to not be thread-safe,
   (this includes the getaddrinfo emulation) protect access with a lock. */
#if defined(WITH_THREAD) && (defined(__APPLE__) || \
    (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \
    defined(__OpenBSD__) || defined(__NetBSD__) || \
    defined(__VMS) || !defined(HAVE_GETADDRINFO))
#define USE_GETADDRINFO_LOCK
#endif

I think it is worthwhile to investigate whether or not getaddrinfo on OSX is really not thread safe. 

Some source code for OSX can be found at the link below, I haven't checked yet which OSX release this corresponds to:

http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.c
History
Date User Action Args
2015-12-22 12:57:11ronaldoussorensetrecipients: + ronaldoussoren, ned.deily
2015-12-22 12:57:10ronaldoussorensetmessageid: <1450789030.99.0.515103781608.issue25924@psf.upfronthosting.co.za>
2015-12-22 12:57:10ronaldoussorenlinkissue25924 messages
2015-12-22 12:57:09ronaldoussorencreate