[issue2029] zeroconf intermittently errors out in paths and serve

Henrik Stuart bugs at mercurial.selenic.com
Sat Feb 6 18:41:48 UTC 2010


New submission from Henrik Stuart <hg at hstuart.dk>:

Most of these tracebacks are caused by the threading model that Zeroconf
uses as the interpreter will reach teardown mode at the time that some parts
of Zeroconf are run, so some modules will be unloaded, functions will be
None, etc.

Traceback (most recent call last):
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 865, in run

traceback module is no longer defined.

Exception in thread Thread-3 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 1022, in run
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 987, in <lambda>
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/__init__.py",
line 129, in addService
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 1311, in getServiceInfo
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 1201, in request
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 1298, in wait
  File "/usr/lib/python2.6/threading.py", line 135, in release
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
Unhandled exception in thread started by 
Error in sys.excepthook:

Original exception was:

This one happens in a couple of different variations. They happen after
zeroconf.wait() has been called and the interpreter is closing down.

E.g.:

Unhandled exception in thread started by 
Error in sys.excepthook:

Original exception was:
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 851, in run
<type 'exceptions.TypeError'>: 'NoneType' object is not callable
Unhandled exception in thread started by 
Error in sys.excepthook:

Original exception was:

For the same reason.

And finally there is this exception:

Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 525, in __bootstrap_inner
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 936, in run
  File "crew.clean/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 1297, in wait
  File "/usr/lib/python2.6/threading.py", line 261, in wait
<type 'exceptions.ValueError'>: list.remove(x): x not in list
Unhandled exception in thread started by 
Error in sys.excepthook:

Original exception was:

This is caused by interpreter shutdown while some thread is in
threading.Condition.wait, so some of the Condition.wait internals are no
longer available.

On the server side we intermittently get this error from reading a
DNSPointer inside the readName method:

Traceback (most recent call last):
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 865, in run
    self.readers[socket].handle_read()
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 909, in handle_read
    msg = DNSIncoming(data)
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 470, in __init__
    self.readOthers()
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 545, in readOthers
    rec = DNSPointer(domain, info[0], info[1], info[2], self.readName())
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 595, in readName
    result = ''.join((result, self.readUTF(off, len) + '.'))
  File "crew.sslcert/build/lib.linux-i686-2.6/hgext/zeroconf/Zeroconf.py",
line 578, in readUTF
    result = self.data[offset:offset+len].decode('utf-8')
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0:
unexpected code byte

Basically the string that is supposed to be read is a completely bogus
string, and as an interesting aside 0x80 is the UNKNOWN entry type, so there
might be some part in the protocol implementation that is off, but I haven't
gone spelunking into the RFC details yet.

All in all, fixing zeroconf to work sanely seems daunting at best at this
point, due to the non-trivial interleaved use of threads.

----------
messages: 11628
nosy: hstuart
priority: bug
status: unread
title: zeroconf intermittently errors out in paths and serve

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2029>
____________________________________________________


More information about the Mercurial-devel mailing list