[pypy-issue] [issue1492] eventlet example fails only on pypy

Drew Gulino tracker at bugs.pypy.org
Wed May 22 16:41:58 CEST 2013


New submission from Drew Gulino <drew.gulino at gmail.com>:

The example on http://eventlet.net fails on pypy 2.0, 2.0.2 running on OSX
10.8.3, works on CPython

pypy:
Python 2.7.3 (5acfe049a5b0, May 21 2013, 13:47:22)
[PyPy 2.0.2 with GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin

CPython:
Python 2.7.5 (default, May 19 2013, 13:26:46) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin

pip freeze (same on both):
cffi==0.6
eventlet==0.12.1
greenlet==0.4.0
wsgiref==0.1.2

code:
#!/usr/bin/env pypy

urls = ["http://www.google.com/intl/en_ALL/images/logo.gif",
        "http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif"]

import eventlet
from eventlet.green import urllib2

def fetch(url):

    return urllib2.urlopen(url).read()

pool = eventlet.GreenPool()

for body in pool.imap(fetch, urls):
    print "got body", len(body)

error:
Traceback (most recent call last):
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/hubs/poll.py",
line 97, in wait
    readers.get(fileno, noop).cb(fileno)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib_pypy/greenlet.py", line
52, in switch
    return self.__switch('switch', args)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib_pypy/greenlet.py", line
81, in __switch
    args = unbound_method(current, *args, to=target)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib_pypy/greenlet.py", line
134, in _greenlet_start
    res = greenlet.run(*args)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenthread.py",
line 194, in main
    result = function(*args, **kwargs)
  File "./eventlet_crawl.py", line 11, in fetch
    return urllib2.urlopen(url).read()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 401, in read
    data = self._sock.recv(rbufsize)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/httplib.py",
line 561, in read
    s = self.fp.read(amt)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 430, in read
    data = self._sock.recv(left)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenio.py",
line 238, in recv
    return fd.recv(buflen, flags)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 188, in recv
    return self._sock.recv(buffersize, flags=flags)
error: [Errno 9] Bad file descriptor
Removing descriptor: 6
Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "./eventlet_crawl.py", line 15, in <module>
    for body in pool.imap(fetch, urls):
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenpool.py",
line 232, in next
    val = self.waiters.get().wait()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenthread.py",
line 168, in wait
    return self._exit_event.wait()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/event.py",
line 116, in wait
    return hubs.get_hub().switch()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/hubs/hub.py",
line 187, in switch
    return self.greenlet.switch()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib_pypy/greenlet.py", line
52, in switch
    return self.__switch('switch', args)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib_pypy/greenlet.py", line
81, in __switch
    args = unbound_method(current, *args, to=target)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenthread.py",
line 194, in main
    result = function(*args, **kwargs)
  File "./eventlet_crawl.py", line 11, in fetch
    return urllib2.urlopen(url).read()
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 401, in read
    data = self._sock.recv(rbufsize)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/httplib.py",
line 561, in read
    s = self.fp.read(amt)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 430, in read
    data = self._sock.recv(left)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy_env/site-packages/eventlet/greenio.py",
line 238, in recv
    return fd.recv(buflen, flags)
  File
"/Users/drewgulino/Downloads/python/pypy/pypy-2.0.2/lib-python/2.7/socket.py",
line 188, in recv
    return self._sock.recv(buffersize, flags=flags)
error: [Errno 9] Bad file descriptor

----------
messages: 5748
nosy: dgulino, pypy-issue
priority: bug
release: 2.0
status: unread
title: eventlet example fails only on pypy

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


More information about the pypy-issue mailing list