New submission from Julien Palard:

I just found that python consider linux implementation of getaddrinfo thread 
safe :

./python2.6-2.6.8/Modules/socketmodule.c:180

/* 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

Badly, it's wrong on my version of linux, and maybe others : 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=722075

So for me, looping in three threads on getaddrinfo leads me to a rapid 
deadlock, while reading on a NETLINK socket, after another thread wrote a DNS 
query on it and trying to get a response on it.

It may only be reproductible when your getaddrinfo use a NETLINK to get 
informations about your interfaces before doing the DNS query.

----------
messages: 216121
nosy: Julien.Palard
priority: normal
severity: normal
status: open
title: getaddrinfo is wrongly considered thread safe on linux

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

Reply via email to