filedescriptor out of range in select()

Steve Holden sholden at holdenweb.com
Fri Jun 27 16:45:50 CEST 2003


"Paolo Invernizzi" <paoloinvernizzi at dmsware.com> wrote in message
news:mailman.1056716925.10216.python-list at python.org...
> Fredrik Lundh wrote:
>
> > but I'm pretty sure asyncore supports the "poll" interface.  try
changing
> > the asyncore.loop call in Dibbler.py to:
> >
> >     asyncore.loop(map=context._map, use_poll=1)
> >
> > and see what happens.
>
> Here we are again....
> Too many open files... with poll too...
>
> ---
> Paolo
>
> SpamBayes POP3 Proxy Beta1, version 0.1 (May 2003),
> using SpamBayes POP3 Proxy Web Interface Alpha2, version 0.02
> and engine SpamBayes Beta1, version 0.1 (May 2003).
>
> Loading database... Done.
> SMTP Listener on port 2525 is proxying 127.0.0.1:25
> Listener on port 8110 is proxying kpnqwest.it:110
> User interface url is http://localhost:8880/
> error: uncaptured python exception, closing channel
> <__main__.BayesProxyListener listening :8110 at 0x83c9f6c>
> (socket.error:(24, 'Too many open files')
[...]
> Traceback (most recent call last):
>    File "/usr/local/bin/pop3proxy.py", line 731, in ?
>      run()
>    File "/usr/local/bin/pop3proxy.py", line 725, in run
>      main(state.servers, state.proxyPorts, state.uiPort, state.launchUI)
>    File "/usr/local/bin/pop3proxy.py", line 664, in main
>      Dibbler.run(launchBrowser=launchUI)
>    File "/usr/local/lib/python2.2/site-packages/spambayes/Dibbler.py",
> line 528, in run
>      asyncore.loop(map=context._map,use_poll=1)
>    File "/usr/local/lib/python2.2/asyncore.py", line 206, in loop
>      poll_fun (timeout, map)
>    File "/usr/local/lib/python2.2/asyncore.py", line 190, in poll3
>      obj.handle_error()
>    File "/usr/local/lib/python2.2/site-packages/spambayes/Dibbler.py",
> line 205, in handle_error
>      asynchat.async_chat.handle_error(self)
>    File "/usr/local/lib/python2.2/asyncore.py", line 427, in handle_error
>      self.close()
>    File "/usr/local/bin/pop3proxy.py", line 368, in close
>      if not self.isClosed:
>    File "/usr/local/lib/python2.2/asyncore.py", line 372, in __getattr__
>      return getattr (self.socket, attr)
> AttributeError: '_socket.socket' object has no attribute 'isClosed'
>

I suspect that the "too many open files" is simply a symptom of a deeper
problem, in that your sockets aren't being correctly closed due to a
programming error. The asyncore framework will happily continue to run even
if errors occur in the event-handling routines, cneatly demonstrating the
dangers of an unlimited "try:/except:".

There's a clear implication here that a BayesProxy instance isn't running
its __init__() method, because if it *were* running it the isClosed
attribute would be defined.

Are you perchance subclassing Bayesproxy and overriding its __init__()
rather than extending it? If so then try adding

    BayesProxy.__init__(self,  clientSocket, serverName, serverPort)

or equivalent to your subclass' __init__().

regards
--
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/







More information about the Python-list mailing list