psychoone7 / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
0 stars 0 forks source link

recv() can return EAGAIN #255

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
2013-04-25 16:21:51,975 pyftpdlib    ERROR    unhandled exception in instance 
<ftphosting.cli.management.commands.ftpd.ExplicitHandler object at 0x2f38fd0>
Traceback (most recent call last):
  File "/usr/lib64/python2.7/asynchat.py", line 110, in handle_read
    data = self.recv (self.ac_in_buffer_size)
  File "/usr/local/env/virtualenv/lib/python2.7/site-packages/pyftpdlib/handlers.py", line 3044, in recv
    return super(SSLConnection, self).recv(buffer_size)
  File "/usr/local/env/virtualenv/lib/python2.7/site-packages/pyftpdlib/ioloop.py", line 866, in recv
    data = self.socket.recv(buffer_size)
error: [Errno 11] Resource temporarily unavailable

...this can happen also with a plain-text (non SSL) socket.

Original issue reported on code.google.com by g.rodola on 26 Apr 2013 at 12:57

GoogleCodeExporter commented 9 years ago
To be precise this is a bug with asyncore:
http://bugs.python.org/issue16133
The fix is not immediately easy as in case of EAGAIN recv() should return None 
and the upper functions calling recv() are currently not designed to take that 
into account.
Returning '' would be a mistake as for asynchat that's an alias for "connection 
lost".

Original comment by g.rodola on 26 Apr 2013 at 1:05