Issues

Issue #1430 open

gethostbyname_ex should use thread-safe functions rather than locks

Anonymous created an issue

From (bugs.pypy.org) by: Vasily Evseenko

Comments (7)

  1. Anonymous

    From (bugs.pypy.org) by: Vasily Evseenko

    There are some memory corruption while calling socket.gethostbyname_ex
    from the thread while other thread executes JIT'ed code:
    In such case socket.gethostbyname_ex returns random entries from
    /etc/hosts instead of DNS lookup.
    
    Notes from dev-list:
    ---
    - it reproduces even without a JIT-enabled pypy
    - PyPy uses gethostbyname() instead of gethostbyname_r()
    ---
    
    Affected versions: PyPy 1.8, 1.9, 2.0b1 on Linux   (Fedora 16, Debian
    GNU/Linux 6.0)
    ---
    Python 2.7.3 (07e08e9c885ca67d89bcc304e45a32346daea2fa, Mar 19 2013,
    07:39:19)
    [PyPy 2.0.0-beta1 with GCC 4.4.5] on linux2
    
    Python 2.7.3 (07e08e9c885ca67d89bcc304e45a32346daea2fa, Dec 18 2012,
    05:33:54)
    [PyPy 2.0.0-beta1 with GCC 4.6.3] on linux2
    
    Python 2.7.2 (2346207d99463f299f09f3e151c9d5fa9158f71b, May 15 2012,
    11:08:08)
    [PyPy 1.8.0 with GCC 4.6.3] on linux2
    
    Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Oct 23 2012,
    11:37:42)
    [PyPy 1.9.0 with GCC 4.6.3] on linux2
    ---
    
    Not affected: PyPy 2.0b1 on MacOSX
    ---
    Python 2.7.3 (07e08e9c885ca67d89bcc304e45a32346daea2fa, Mar 19 2013,
    07:52:27)
    [PyPy 2.0.0-beta1] on darwin
    
    Python 2.7.3 (7e4f0faa3d51, Nov 21 2012, 15:59:46)
    [PyPy 2.0.0-beta1 with GCC 4.2.1] on darwin
    ---
    
  2. Anonymous

    From (bugs.pypy.org) by: Vasily Evseenko

    Are there any way to convert DNS name to list of ip-addresses without external
    locks on PyPy?
    
  3. bdk
    corruption fixed with merge of issue1430 branch in commit 9fe91ecfce83
    
    leaving this open at a lower priority as we probably want to use the thread-safe 
    versions of gethostxxx instead of using locks, when possible.
    
  4. Log in to comment