asyncore.dispatcher stops listening

Jean-Paul Calderone exarkun at divmod.com
Mon Sep 4 22:17:22 EDT 2006


On Mon, 4 Sep 2006 19:03:09 -0700, Daniel Walton <walton.dan at gmail.com> wrote:
>I have been working on a problem for a full week now.  If someone
>could please help me it would be great.  Even a clue would be great at
>this point.  What I am seeing is quite a mystery.
>
>I have server written in python using asyncore.dispatcher.  It listens
>on port 9940 and does something like this on handle_accept
>
>    def handle_accept (self):
>        self.log("accept")
>        conn, addr = self.accept()
>        self.handlers += [asynchat.async_chat_subclass(conn,addr)]
>
>I launch the server and test the server.  Everything looks great aside
>from a few functions that are a bit slow.
>
>The server goes into use and receives some traffic for about 3 days
>and then it stops listening.  telneting to the port times out.
>clients (8 or so) that are connected time out.  The process is still
>running.  Its not taking lots of CPU or memory.  I can start a new
>server on the port without being told that something else is using it.
>
>When I send the server a kill -SIGINT  I get this call stack in the log
>Traceback (most recent call last):
>  File "./link_server.py", line 975, in ?
>    main(sys.argv)
>  File "./link_server.py", line 973, in main
>    asyncore.loop()
>  File "/usr/local/lib/python2.4/asyncore.py", line 192, in loop
>    poll_fun(timeout, map)
>  File "/usr/local/lib/python2.4/asyncore.py", line 122, in poll
>    r, w, e = select.select(r, w, e, timeout)
>KeyboardInterrupt

What does /proc/ say about the server's open file descriptors?  What
about r, w, e, and timeout?  What are their values?

Jean-Paul



More information about the Python-list mailing list