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 <rep...@bugs.python.org> <http://bugs.python.org/issue25924> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com