Note that there are some explanatory texts on larger screens.

plurals
  1. POPython, Asyncore and forks
    primarykey
    data
    text
    <p>Just for starters, I used Twisted and SocketServer with both ForkMixIn, ThreadMixIn and tried the "thread-pool" recepies.</p> <p>However, I wanted to make something particular work in Python.</p> <p>Alittle background. Previously I wrote in C a simple TCP deamon that would bind to a socket and listen on it, then pre-fork X many times and then just pass the serversocket desc to all the forks and everyone would accept the clients very very marrily.</p> <p>I checked out the "select/poll" based asyncore which I like alot. My only beef was that I could get a little CPU unbound by forking a few times to take advantage of the multi-cpu machine and hope for the best with scheduling.</p> <p>I cant make it work for the life of me. Only 1 single instance can accept connections, all others simply throw an exception on handling the connect, 'can not iterate thru Empty'.</p> <p>is this even feasible? I checked alot, but I couldnt find ANY code for forking asyncore dispatchers (cry)</p> <p>Thank you!</p> <p><strong>Update 1: (Full traceback as requested)</strong></p> <pre><code>error: uncaptured python exception, closing channel &lt;__main__.EchoServer listening 0.0.0.0:8001 at 0x2ad4880c93f8&gt; (&lt;type 'exceptions.TypeError'&gt;:'NoneType' /python2.6/asyncore.py|readwrite|99] [/usr/local/python2.6.9/lib/python2.6/asyncore.py|handle_read_event|408] [./6py-server.py|handle_accept|87]) </code></pre> <p>Always happens in accept, regardless if I fork before the asyncore.loop, etc.</p> <p><strong>Update 2: (full source)</strong> <a href="http://pastebin.ca/1666012" rel="nofollow noreferrer">pastebined source</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload