From owner-freebsd-python@FreeBSD.ORG Tue Jul 8 12:35:22 2008 Return-Path: Delivered-To: python@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4C331065679; Tue, 8 Jul 2008 12:35:22 +0000 (UTC) (envelope-from andymac@bullseye.apana.org.au) Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mx1.freebsd.org (Postfix) with ESMTP id CA1258FC1F; Tue, 8 Jul 2008 12:35:21 +0000 (UTC) (envelope-from andymac@bullseye.apana.org.au) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkQFAFT4ckg7pyt2/2dsb2JhbACBXKlL X-IronPort-AV: E=Sophos;i="4.30,323,1212330600"; d="scan'208";a="144462504" Received: from ppp59-167-43-118.lns2.cbr1.internode.on.net (HELO bullseye.apana.org.au) ([59.167.43.118]) by ipmail01.adl6.internode.on.net with ESMTP; 08 Jul 2008 21:48:49 +0930 Received: from [192.168.63.10] (tenring.andymac.org [192.168.63.10]) by bullseye.apana.org.au (8.14.2/8.14.2) with ESMTP id m68CHVfA048175; Tue, 8 Jul 2008 22:17:31 +1000 (EST) (envelope-from andymac@bullseye.andymac.org) Message-ID: <48734D3F.5070008@bullseye.andymac.org> Date: Tue, 08 Jul 2008 22:19:27 +1100 From: Andrew MacIntyre User-Agent: Thunderbird 2.0.0.14 (OS/2/20080509) MIME-Version: 1.0 To: Kris Kennaway References: <48711120.1000209@FreeBSD.org> In-Reply-To: <48711120.1000209@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: neal@nelson.name, wxs@FreeBSD.org, python@FreeBSD.org Subject: Re: py-bittorrent/twistedCore broken on 8.0? X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2008 12:35:22 -0000 Kris Kennaway wrote: > I am trying to use the python bittorrent tracker with python 2.5 and > FreeBSD 8.0, but I am getting a lot of errors from the kqueue reactor in > twisted. > > pointyhat# bittorrent-tracker > track: create_serversocket, port= 80 > Traceback (most recent call last): > File "/usr/local/lib/python2.5/site-packages/BitTorrent/track.py", > line 925, in track > r.listen_forever() > File > "/usr/local/lib/python2.5/site-packages/BitTorrent/RawServer_twisted.py", > line 790, in listen_forever > reactor.run(installSignalHandlers=False) > File "/usr/local/lib/python2.5/site-packages/BTL/reactor_magic.py", > line 60, in run_default > return old_run(**kw) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 220, in run > self.mainLoop() > --- --- > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 231, in mainLoop > self.doIteration(t) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/kqreactor.py", > line 169, in doKEvent > selectable = selectables[fd] > exceptions.KeyError: 4L > Traceback (most recent call last): > File "/usr/local/lib/python2.5/site-packages/BitTorrent/track.py", > line 925, in track > r.listen_forever() > File > "/usr/local/lib/python2.5/site-packages/BitTorrent/RawServer_twisted.py", > line 790, in listen_forever > reactor.run(installSignalHandlers=False) > File "/usr/local/lib/python2.5/site-packages/BTL/reactor_magic.py", > line 60, in run_default > return old_run(**kw) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 220, in run > self.mainLoop() > --- --- > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 231, in mainLoop > self.doIteration(t) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/kqreactor.py", > line 169, in doKEvent > selectable = selectables[fd] > exceptions.KeyError: 4L > Traceback (most recent call last): > File > "/usr/local/lib/python2.5/site-packages/BitTorrent/RawServer_twisted.py", > line 790, in listen_forever > reactor.run(installSignalHandlers=False) > File "/usr/local/lib/python2.5/site-packages/BTL/reactor_magic.py", > line 60, in run_default > return old_run(**kw) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 220, in run > self.mainLoop() > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/posixbase.py", > line 228, in mainLoop > self.runUntilCurrent() > --- --- > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/base.py", line > 561, in runUntilCurrent > call.func(*call.args, **call.kw) > File > "/usr/local/lib/python2.5/site-packages/BitTorrent/HTTPHandler.py", line > 175, in connection_flushed > connection.shutdown(1) > File > "/usr/local/lib/python2.5/site-packages/BitTorrent/RawServer_twisted.py", > line 238, in shutdown > self.transport.loseWriteConnection() > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/abstract.py", > line 244, in loseWriteConnection > self.startWriting() > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/abstract.py", > line 273, in startWriting > self.reactor.addWriter(self) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/kqreactor.py", > line 107, in addWriter > self._updateRegistration(fd, EVFILT_WRITE, EV_ADD) > File > "/usr/local/lib/python2.5/site-packages/twisted/internet/kqreactor.py", > line 89, in _updateRegistration > kq.kevent([kevent(*args)], 0, 0) > exceptions.OSError: [Errno 9] Bad file descriptor > [...] > > i.e. just it is getting exceptions when doing nothing at all, so it > seems to be completely broken. > > Have you tried this, or do you know where to begin looking at what might > be wrong? I know very little about Twisted, but I seem to recall that it offers a range of different reactors; if you can find where in bittorrent its deciding to use the kqreactor, you might be able to force it to use an alternate reactor (such as one based on select() or poll()). If you can change the reactor and get something that works, that would suggest some issue with the kqreactor, at least on 8.x. -- ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia