[Mono-bugs] [Bug 71211][Maj] New - Interlocked.Increment not incrementing

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 12 Jan 2005 13:49:19 -0500 (EST)


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 lluis@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=71211

--- shadow/71211	2005-01-12 13:49:19.000000000 -0500
+++ shadow/71211.tmp.15524	2005-01-12 13:49:19.000000000 -0500
@@ -0,0 +1,64 @@
+Bug#: 71211
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: JIT
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lluis@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Interlocked.Increment not incrementing
+
+In remoting there is a Interlocked.Increment call that looks like it is not
+working properly. Try the following test case:
+
+using System;
+using System.Runtime.Remoting;
+using System.Threading;
+
+public class Test: MarshalByRefObject
+{
+	public static void Main (string[] args)
+	{
+		AppDomain dom = AppDomain.CreateDomain ("other");
+		for (int n=0; n<5; n++) {
+			Test test = (Test) dom.CreateInstanceAndUnwrap
+(typeof(Test).Assembly.ToString (), "Test");
+			Console.WriteLine (RemotingServices.GetObjectUri (test));
+		}
+	}
+}
+
+It will print a serie of uris like the following:
+
+b9bd6b3c_f347_4343_9334_be7d8dfd4f1c/1745677016_2.rem
+b9bd6b3c_f347_4343_9334_be7d8dfd4f1c/1745677063_2.rem
+b9bd6b3c_f347_4343_9334_be7d8dfd4f1c/1745677118_2.rem
+b9bd6b3c_f347_4343_9334_be7d8dfd4f1c/1745677174_2.rem
+b9bd6b3c_f347_4343_9334_be7d8dfd4f1c/1745677229_2.rem
+
+Those uris are built in RemotingServices.NewUri(), which looks like this:
+
+static string NewUri ()
+{
+	int n = Interlocked.Increment (ref next_id);
+	return app_id + Environment.TickCount + "_" + n + ".rem";
+}
+
+The last component of the uri is a static variable which is never reseted,
+but it nevers goes beyond 2.
+
+When running the test case in mono 1.0, it prints correct uris:
+
+b1437fdc_a97f_433f_8c20_f07608d5d9be/353426039_3.rem
+b1437fdc_a97f_433f_8c20_f07608d5d9be/353426172_4.rem
+b1437fdc_a97f_433f_8c20_f07608d5d9be/353426232_5.rem
+b1437fdc_a97f_433f_8c20_f07608d5d9be/353426290_6.rem
+b1437fdc_a97f_433f_8c20_f07608d5d9be/353426350_7.rem