[New-bugs-announce] [issue25924] investigate if getaddrinfo(3) on OSX is thread-safe

Ronald Oussoren report at bugs.python.org
Tue Dec 22 07:57:10 EST 2015


New submission from Ronald Oussoren:

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

----------
assignee: ronaldoussoren
components: Macintosh
messages: 256838
nosy: ned.deily, ronaldoussoren
priority: low
severity: normal
status: open
title: investigate if getaddrinfo(3) on OSX is thread-safe
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25924>
_______________________________________


More information about the New-bugs-announce mailing list