On Thu, Sep 3, 2009 at 5:40 PM, Michael Schurter<[email protected]> wrote: > Hi all, > > I'm trying to use dnspython in a threaded CherryPy app, but as far as > I can tell the Resolver class is not threadsafe. I create 1 Resolver > instance per thread and when I do a number of lookups across all > threads I get a number of exceptions like this one: > > Exception in thread Thread-29: > Traceback (most recent call last): > File "threading.py", line 460, in __bootstrap > self.run() > File "threading.py", line 440, in run > self.__target(*self.__args, **self.__kwargs) > File "testing/dnsutil_thread_tester.py", line 31, in worker > host = resolver.reverse(ip) > File "/home/.../G/bix/ui/bixui/lib/dnsutil.py", line 19, in reverse > response = self.resolver.query(q, 'PTR') > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/resolver.py", > line 590, in query > request = dns.message.make_query(qname, rdtype, rdclass) > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/message.py", > line 1032, in make_query > m = Message() > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/message.py", > line 137, in __init__ > self.id = dns.entropy.random_16() > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/entropy.py", > line 92, in random_16 > return pool.random_16() > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/entropy.py", > line 69, in random_16 > return self.random_8() * 256 + self.random_8() > File > "/home/.../lib/python2.5/site-packages/dnspython-1.7.1-py2.5.egg/dns/entropy.py", > line 64, in random_8 > value = ord(self.digest[self.next_byte]) > IndexError: string index out of range > > 8<------snip-------8<------- > > have git handy, but I may try to work up a patch. :-)
Here it is: http://dpaste.de/1WyA/ I know its ridiculously small compared to the previous module, but my code runs fine with it! (Its trivial enough I present it as public domain. No need to change the copyright notice or anything.) Thoughts? _______________________________________________ dnspython-users mailing list [email protected] http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users
