From: Jan E. <ch...@in...> - 2004-04-13 05:51:45
|
On Mon, 12 Apr 2004, Marcus Alanen wrote: >Uf. Taking a much-needed look at Civil's network handling, I must >confess that the whole circus with threads feels odd. > >I think the server-side connection handling is actually racy somewhere, >since my civil server hangs on the futex syscall when the client crashes >with a traceback: > >futex(0x82420e0, FUTEX_WAIT, 0, NULL <unfinished ...> > >(futex == fast user-space mutex, Linux 2.6's new way to handle mutexes) I wasn't aware that Python already utilized futexes, but apparently it does? >I actually have code that removes the client-side "poller thread", I was >thinking of committing it. It would use socket.setblocking(0) to make >sure that it can't block on receving network data. [1] Opinions? Would that make it poll, and thus increase load? The original reason for a thread was to get rid of the load that polling introduced? >Similarly, I'd like to try to remove the server-side "poller thread", >opinions? The serverside should be simple to get rid of, it's basically just something like this: while 1: sleep 1s while socket.hasData(): socket.readNoBlock() calculateStuff() Yes, I'm all for getting rid of extra complexity if you think it's a good idea. Please commit. >[1] I just have to get myself Stevens' networking book(s). Saw one in >the bookstore on Saturday, mere 90+ euros. Argh. There are quite a few of them, actually. If you get the networking bible be sure to get the newest edition. I have the old one and it's also good, but the newer one has some more goodies. All Stevens books are excellent toilet and bedtime reading. :) -- In the Beginning it was a nice day. -- Terry Pratchett & Neil Gaiman, Good Omens |