[pypy-issue] [issue1568] Using socket.makefile from eventlet results in hangs

Alex Gaynor tracker at bugs.pypy.org
Tue Jul 30 23:42:39 CEST 2013


New submission from Alex Gaynor <alex.gaynor at gmail.com>:

This code runs easily under CPython, but under PyPy is hangs:

import eventlet
from eventlet.green import socket


def accept(sock, addr):
    sock.sendall("HTTP/1.1 201 OK\r\nContent-Length: 0\r\n\r\n")
    sock.recv(247)
    sock.recv(247)


def accept_listener(bindsock):
    sock, addr = bindsock.accept()
    return eventlet.spawn(accept, sock, addr)


def send_raw(bindsock):
    c = socket.socket()
    c.connect(bindsock.getsockname())
    c.sendall('GET / HTTP/1.1\r\n\r\n')
    f = c.makefile()
    f.close()

def main():
    bindsock = eventlet.listen(("127.0.0.1", 0))
    spawned = eventlet.spawn(accept_listener, bindsock)
    eventlet.spawn(send_raw, bindsock)
    spawned.wait().wait()



if __name__ == "__main__":
    main()

----------
messages: 6011
nosy: agaynor, pypy-issue
priority: bug
status: unread
title: Using socket.makefile from eventlet results in hangs

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1568>
________________________________________


More information about the pypy-issue mailing list