New submission from A. Jesse Jiryu Davis:

In socketmodule.c we lock around getaddrinfo calls on platforms where 
getaddrinfo is believed not to be thread-safe. We've verified that it *is* 
thread-safe, and therefore stopped locking around it, on FreeBSD 5.3+ 
(#1288833) and Mac OS X 10.5+ (#25924). This ticket intends to do the same for 
OpenBSD and NetBSD.

OpenBSD 5.4 fixed getaddrinfo's thread safety and announced it 2013-11-01, 
"getaddrinfo(3) is now thread-safe":

http://www.openbsd.org/plus54.html

NetBSD's fix is older and less publicized. Since ancient times NetBSD's 
getaddrinfo.c included a comment, "Thread safe-ness must be checked", and the 
getaddrinfo(3) man page had the same warning as other BSDs, "The implementation 
of getaddrinfo is not thread-safe." On 2004-05-27 Christos Zoulas committed 
with the comment "make yp stuff re-entrant", fixing obvious problems like 
static variables in getaddrinfo:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.71&r2=1.72&only_with_tag=MAIN

That change was released with NetBSD 3.0, and that alone might convince us to 
stop locking around getaddrinfo. Later, on 2006-07-18, between NetBSD 3 and 4, 
Zoulas deleted the comment "Thread safe-ness must be checked" from the source, 
with the message "Remove comments that do not reflect reality anymore":

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&r2=1.83&only_with_tag=MAIN

The same day, he removed the man page warning:

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.3.diff?r1=1.43&r2=1.44&only_with_tag=MAIN

NetBSD 4.0 was released 2007-12-19.

----------
messages: 260655
nosy: emptysquare, gvanrossum, martin.panter, ned.deily, python-dev, 
ronaldoussoren, yselivanov
priority: normal
severity: normal
status: open
title: getaddrinfo is thread-safe on NetBSD and OpenBSD
versions: Python 2.7, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26406>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to