[Mono-bugs] [Bug 47672][Wis] New - Thread.SetData throws ArgumentException only with Mono
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sat, 16 Aug 2003 01:09:06 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by cmars@ziplip.com.
http://bugzilla.ximian.com/show_bug.cgi?id=47672
--- shadow/47672 2003-08-16 01:09:06.000000000 -0400
+++ shadow/47672.tmp.11253 2003-08-16 01:09:06.000000000 -0400
@@ -0,0 +1,75 @@
+Bug#: 47672
+Product: Mono/Runtime
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: cmars@ziplip.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Thread.SetData throws ArgumentException only with Mono
+
+Description of Problem:
+Thread.SetData, specifically in Bamboo.Prevalence 1.4, throws
+ArgumentException when run with mono 0.25 or 0.26 on both linux and win32
+OS, running on P4 (effectively dual processor because of the
+hyperthreading). The same code works fine on MS.NET.
+
+Steps to reproduce the problem:
+1. Download Bamboo.Prevalence 1.4 from http://bbooprevalence.sourceforge.net.
+2. Compile examples/MyFirstPrevalentSystem. Use mcs or csc, no difference.
+ (mcs -reference:../../bin/Bamboo.Prevalence.dll *.cs)
+3. Run mono Application.exe.
+
+Actual Results:
+
+
+Expected Results:
+Unhandled Exception: System.ArgumentException: Key duplication when adding:
+System.LocalDataStoreSlot
+
+Server stack trace:
+in <0x0027b> 00 System.Collections.Hashtable:PutImpl (object,object,bool)
+in <0x00019> 00 System.Collections.Hashtable:Add (object,object)
+in <0x0004b> 00 System.Threading.Thread:SetData
+(System.LocalDataStoreSlot,object)
+in <0x0000f> 00 Bamboo.Prevalence.PrevalenceEngine:ShareCurrentObject ()
+in <0x0000a> 00 Bamboo.Prevalence.PrevalenceEngine:BeforeQuery ()
+in <0x0001b> 00
+Bamboo.Prevalence.Implementation.PrevalentSystemProxy:ExecuteQuery
+(System.Runtime.Remoting.Messaging.IMethodCallMessage)
+in <0x000d9> 00
+Bamboo.Prevalence.Implementation.PrevalentSystemProxy:Invoke
+(System.Runtime.Remoting.Messaging.IMessage)
+
+How often does this happen?
+Every time
+
+Additional Information:
+
+I peeked at the sources:
+Thread.SetData uses a key from GetTLSSlotHash() to index into a Hashtable.
+ The exception is thrown AFAIK b/c the key is not unique when it should be.
+
+GetTLSSlotHash() gets its value from SlotHash_lookup(), which gets its
+value from:
+
+/* The TLS key that holds the LocalDataStoreSlot hash in each thread */
+static guint32 slothash_key;
+
+in mono-0.26/mono/metadata/threads.c (which is why I classify this bug
+report as a runtime issue). Well, if slothash_key is a static global, then
+multiple threads will reference the same value.
+
+It seems to me that this and probably other static values in threads.c need
+to be indexed by thread ID to prevent collisions. This is just my educated
+guess.
+
+Your help on this is greatly appreciated!