On Tue, Jan 27, 2009 at 04:01:13PM -0800, Matt Kraai wrote: > When I try to create an experimental pbuilder chroot using > pbuilder --create --distribution experimental > it fails with the following error message: [...] > Rebuilding Xapian index... 39% > Traceback (most recent call last): > File "/usr/sbin/update-apt-xapian-index", line 527, in <module> > childProgress.loop() > File "/usr/sbin/update-apt-xapian-index", line 125, in loop > msg = self.sock.recv(4096) > socket.timeout: timed out [...] > I can't figure out why that exception is raised, however: according to > the exception's documentation, it's raised if the timeout's been set > via a call to settimeout, but there are no such calls in > update-apt-xapian-index.
Indeed, according to the exception documentation, the default is None
(no timeout), but if I add this to the code, just after
self.sock.connect(XAPIANDBUPDATESOCK) in ClientProgress.__init__:
print "TIMEOUT", self.sock.gettimeout()
I get a nice "2.0".
This patch fixes the problem:
diff --git a/update-apt-xapian-index b/update-apt-xapian-index
index ad815f4..31ecad9 100755
--- a/update-apt-xapian-index
+++ b/update-apt-xapian-index
@@ -116,6 +116,7 @@ class SilentProgress:
class ClientProgress:
def __init__(self, progress):
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ self.sock.settimeout(None)
self.sock.connect(XAPIANDBUPDATESOCK)
self.progress = progress
I can reproduce the issue with this snippet:
#!/usr/bin/python
import apt, socket
srv = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
srv.bind("/tmp/foo.sock")
srv.setblocking(False)
srv.listen(5)
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect("/tmp/foo.sock")
print sock.gettimeout()
s1 = srv.accept()[0]
s1.send("ciao")
print sock.recv(4096)
Importing "apt" is what makes the problem reappear: apt seems to be
changing the default timeout from None to 2.0: I'll reassign this bug
to python-apt.
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <[email protected]>
signature.asc
Description: Digital signature

