I'm going to guess that this is because we use a static instance of MD5CryptoServiceProvider to do the hashing, something which may not be thread-safe. It looks like all of the IronPython crypto implementations do the same thing, so the SHA functions may have a similar issue.<div>
<br></div><div>Please file this as a bug on Codeplex.<br><br><div class="gmail_quote">On Sat, Dec 20, 2008 at 1:56 PM, Brian Merrell <span dir="ltr"><<a href="mailto:brian@merrells.org">brian@merrells.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><font face="Arial" size="2">I get the following error
periodically:</font></div>
<blockquote dir="ltr" style="margin-right:0px">
<div><font face="Arial" size="2">Exception in thread Thread-2:<br>Traceback (most
recent call last):<br> File "C:\Program Files\IronPython 2.0\Lib\threading.py",
line 486, in _Thread__bootstrap_inner<br> self.run()<br> File
"initial_ingest.py", line 33, in run<br> md5 =
hashlib.md5(contents).hexdigest()<br>SystemError: Hash not valid for use in
specified state.</font></div></blockquote>
<div dir="ltr"><font face="Arial" size="2">I am not sharing a md5() object between threads and have tried to avoid any shared memory issues:</font></div>
<div dir="ltr"><font face="Arial" size="2"></font> </div>
<blockquote dir="ltr" style="margin-right:0px">
<div dir="ltr"><font face="Arial" size="2">class Convert(threading.Thread):<br> def
__init__(self, queue):<br> threading.Thread.__init__(self)<br>
self.queue = queue<br> def run(self):<br> import hashlib<br>
while True:<br> abs_filename = self.queue.get()<br> f =
open(abs_filename, "rb")<br> contents = f.read()<br>
f.close()<br> md5 = hashlib.md5(contents).hexdigest()<br>
print md5, abs_filename<br>
self.queue.task_done()</font></div></blockquote>
<div dir="ltr"><font face="Arial" size="2">Any ideas why this is failing? Thanks,</font></div><div dir="ltr"><br></div><font color="#888888"><div dir="ltr">-brian</div>
</font><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br></div>