Thanks! &nbsp;Given that useful multi-threaded hashing is only available because of IronPython&#39;s lack of GIL I can&#39;t complain too much :-) &nbsp;&nbsp;&nbsp;For reference, here is the issue link:<div><br></div><div><a href="http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20324">http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=20324</a><br>
<div><br></div><div>I look forward to the fix in a future release.<div><br></div><div><div><div class="gmail_quote">On Sun, Jan 4, 2009 at 7:09 PM, Curt Hagenlocher <span dir="ltr">&lt;<a href="mailto:curt@hagenlocher.org" target="_blank">curt@hagenlocher.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Not without looking at the source code...<br><br>We want to be at least as thread-safe as CPython, with the exception that we have no interest in implementing the equivalent of a &quot;global interpreter lock&quot; :).&nbsp; This particular case is just bad coding on our part.&nbsp; I can&#39;t promise you that there aren&#39;t other examples, but at least this one is pretty easy to fix.<div>

<div></div><div><br>
<br><div class="gmail_quote">On Sun, Jan 4, 2009 at 8:58 AM, Brian Merrell <span dir="ltr">&lt;<a href="mailto:brian@merrells.org" target="_blank">brian@merrells.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">


Thanks Curt.&nbsp; I&#39;ve filed a bug report.&nbsp; It makes me a bit nervous realizing that it isn&#39;t entirely transparent when shared memory/objects are being used.&nbsp; Normally I would think a local instance of hashlib.md5() would be thread-safe from other local instances.&nbsp; Is there any documentation of what other modules use global/static instances or other non-thread-safe implementations in IronPython?<div>


<div></div><div><br>
<br><div class="gmail_quote">On Tue, Dec 30, 2008 at 12:13 PM, Curt Hagenlocher <span dir="ltr">&lt;<a href="mailto:curt@hagenlocher.org" target="_blank">curt@hagenlocher.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">



I&#39;m going to guess that this is because we use a static instance of&nbsp;MD5CryptoServiceProvider to do the hashing, something which may not be thread-safe. &nbsp;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"><div><div></div><div>On Sat, Dec 20, 2008 at 1:56 PM, Brian Merrell <span dir="ltr">&lt;<a href="mailto:brian@merrells.org" target="_blank">brian@merrells.org</a>&gt;</span> wrote:<br>




</div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div><div><font size="2" face="Arial">I get the following error 
periodically:</font></div>
<blockquote dir="ltr" style="margin-right:0px">
<div><font size="2" face="Arial">Exception in thread Thread-2:<br>Traceback (most 
recent call last):<br>&nbsp; File &quot;C:\Program Files\IronPython 2.0\Lib\threading.py&quot;, 
line 486, in _Thread__bootstrap_inner<br>&nbsp;&nbsp;&nbsp; self.run()<br>&nbsp; File 
&quot;initial_ingest.py&quot;, line 33, in run<br>&nbsp;&nbsp;&nbsp; md5 = 
hashlib.md5(contents).hexdigest()<br>SystemError: Hash not valid for use in 
specified state.</font></div></blockquote>
<div dir="ltr"><font size="2" face="Arial">I am not sharing a md5() object between threads and have tried to avoid any shared memory issues:</font></div>
<div dir="ltr"><font size="2" face="Arial"></font>&nbsp;</div>
<blockquote dir="ltr" style="margin-right:0px">
<div dir="ltr"><font size="2" face="Arial">class Convert(threading.Thread):<br>&nbsp;&nbsp;&nbsp; def 
__init__(self, queue):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; threading.Thread.__init__(self)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.queue = queue<br>&nbsp;&nbsp;&nbsp; def run(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import hashlib<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
while True:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abs_filename = self.queue.get()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = 
open(abs_filename, &quot;rb&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contents = f.read()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
f.close()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5 = hashlib.md5(contents).hexdigest()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
print md5, abs_filename<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.queue.task_done()</font></div></blockquote>
<div dir="ltr"><font size="2" face="Arial">Any ideas why this is failing? &nbsp;Thanks,</font></div><div dir="ltr"><br></div><font color="#888888"><div dir="ltr">-brian</div>
</font><br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">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>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">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></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">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></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">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>
</div></div></div>