[spambayes-dev] Socket problem

Paolo Invernizzi paoloinvernizzi at dmsware.com
Mon Jun 30 16:45:51 EDT 2003


Hi all,

I've some problems with the current pop3proxy.py script.
I'm running spambayes CVS on a FreeBSD 5.1 machine, with python 2.2.3

On my machine I'm lunching the pop3proxy.py with cron at startup, and 
I've a fetchmail process that check the pop3proxy every 10 minutes for 
pop3 updates... and all is fine.

But... sometimes during startup, or after a one or two days, the process 
exits with the following error...

Running the pop3proxy, lanched by cron at startup, works fine, but

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/
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)
   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 83, in poll
     r,w,e = select.select (r,w,e, timeout)
ValueError: filedescriptor out of range in select()


Fredrik Lundh suggested me to use pool, instead of select, so I turned 
asyncore to:
	asyncore.loop(map=context._map, use_poll=1)

Now the error reported is:
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') 
[/usr/local/lib/python2.2/asyncore.py|poll3|184] 
[/usr/local/lib/python2.2/asyncore.py|handle_read_event|391] 
[/usr/local/lib/python2.2/site-packages/spambayes/Dibbler.py|handle_accept|280] 
[/usr/local/bin/pop3proxy.py|__init__|337] 
[/usr/local/bin/pop3proxy.py|__init__|180] 
[/usr/local/bin/pop3proxy.py|__init__|134] 
[/usr/local/lib/python2.2/asyncore.py|create_socket|260])
error: uncaptured python exception, closing channel <__main__.BayesProxy 
connected 192.168.0.2:63485 at 0x84d8aac> 
(exceptions.AttributeError:'_socket.socket' object has no attribute 
'isClosed' [/usr/local/lib/python2.2/asyncore.py|poll3|184] 
[/usr/local/lib/python2.2/asyncore.py|handle_read_event|397] 
[/usr/local/lib/python2.2/asynchat.py|handle_read|82] 
[/usr/local/bin/pop3proxy.py|recv|360] 
[/usr/local/lib/python2.2/asyncore.py|recv|353] 
[/usr/local/lib/python2.2/asynchat.py|handle_close|149] 
[/usr/local/bin/pop3proxy.py|close|368] 
[/usr/local/lib/python2.2/asyncore.py|__getattr__|372])
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'

Any advice??
I've started a thread on this on c.l.python also
http://article.gmane.org/gmane.comp.python.general/72706

---
Paolo Invernizzi





More information about the spambayes-dev mailing list