[Mono-bugs] [Bug 74223][Maj] New - Remoting RPC Call with 2 or more minutes between calls causes memory leak

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 30 Mar 2005 04:52:28 -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 jan.reitz@lanxess.com.

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

--- shadow/74223	2005-03-30 04:52:28.000000000 -0500
+++ shadow/74223.tmp.21858	2005-03-30 04:52:28.000000000 -0500
@@ -0,0 +1,200 @@
+Bug#: 74223
+Product: Mono: Runtime
+Version: 1.1
+OS: Solaris 8
+OS Details: uname -a => 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-5_10
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: remoting
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jan.reitz@lanxess.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Remoting RPC Call with 2 or more minutes between calls causes memory leak
+
+Maybe this Bug is for GC or for remoting.... had to choose one, so its now here
+
+sorry for my english in advance
+
+Description of Problem:
+calling a function on a sun/sparc/mono machine from an winxp/msft.net with
+intervals greater than 2 minutes causes memory usage to grow until its to
+slow to respond because its memory size exceeds real memory on the sun machine.
+
+the program that eats up ram on the sun runs fine under
+(win2k|winxp)/(msft.net|mono)
+
+Steps to reproduce the problem:
+1. run the first program on a sun/sparc/mono and the second on whatever you
+want :
+
+---- program for the sun ----
+using System;
+using System.Threading;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+
+namespace Leak {
+
+	public class MainClass {
+		public static ToWin toWin;	// Remote Object
+
+		[STAThread]
+		static void Main(string[] args) {
+			ChannelServices.RegisterChannel(new TcpChannel(27961));
+			RemotingConfiguration.RegisterWellKnownServiceType(
+				typeof(ToUnix),
+				"Leak",
+				WellKnownObjectMode.Singleton
+			);
+
+			toWin = (ToWin) Activator.GetObject(
+						typeof(ToWin),
+						"tcp://insertHostnameHere:27960/Leak");	// replace this hostname with
+the other hostname
+
+			Console.WriteLine("v0.29");
+
+			Thread.Sleep(System.Threading.Timeout.Infinite);
+		}
+	}
+
+	public class ToWin : MarshalByRefObject {
+		// done in LeakWin
+		public void Testwin(int Number) {}
+	}
+
+	public class ToUnix : MarshalByRefObject {
+		public void Testunix(int Number) {
+			Console.WriteLine("Called from 'LeakWin' : #"+Number);
+			GC.Collect();
+		}
+	}
+}
+
+---- program for windows with mono or msft.net ----
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Threading;
+
+namespace Leak {
+
+	public class MainClass {
+		public static ToUnix toUnix;	// Remote Object to unix/mono
+		public static Timer  timer = new Timer(new
+TimerCallback(CyclicExecution),null,2*1000,130*1000);
+		public static int	 counter = 0;
+
+		[STAThread]
+		static void Main(string[] args) {
+			ChannelServices.RegisterChannel(new TcpChannel(27960));
+			RemotingConfiguration.RegisterWellKnownServiceType(
+				typeof(ToWin),
+				"Leak",
+				WellKnownObjectMode.Singleton
+			);
+
+			toUnix = (ToUnix) Activator.GetObject(
+				typeof(ToUnix),
+				"tcp://insertTheOtherHostname:27961/Leak");	// replace this with the
+unix hostname
+
+			while (true) {
+				string cmd;
+				cmd = Console.ReadLine();
+				if (cmd == "q") {
+					break;
+				}
+			}
+		}
+
+		public static void CyclicExecution(object sender) {
+			Console.WriteLine("Calling Unix : #"+counter);
+			toUnix.Testunix(counter);
+			counter++;
+		}
+	}
+
+	public class ToWin : MarshalByRefObject {
+		public void Testwin(int Number) {
+			Console.WriteLine("Called from 'LeakUnix'");
+		}
+	}
+
+	public class ToUnix : MarshalByRefObject {
+		// done in LeakUnix
+		public void Testunix(int Number) {}
+	}
+}
+
+2. 
+3. 
+
+Actual Results:
+Memory usage on the Sun machine goes up, more than real memory, causes
+application to not respond in less than 14 hours (maybe you know a way to
+speed ist up, but the interval must be more than 2 minutes)
+
+Expected Results:
+Program should run forever not using to much ram (like it did on windows
+with msft.net or mono)
+
+How often does this happen?
+on solaris 8 with mono 1.1.4 / 1.1.5 / 1.0.6 it happens everytime, on mono
+1.0.6 it happens faster (growing mem usage) since its not so mem-optimized
+i think
+
+Additional Information:
+i compiled mono with gcc 3.4.2
+
+mono -V outputs :
+
+Mono JIT compiler version 1.1.5, (C) 2002-2005 Novell, Inc and
+Contributors. www.mono-project.com
+        TLS:           normal
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: normal
+
+Mono JIT compiler version 1.0.6, (C) 2002-2004 Novell, Inc and
+Contributors. www.go-mono.com
+        TLS:           normal
+        GC:            Included Boehm (with typed GC)
+        SIGSEGV      : normal
+        Globalization: none
+
+output of 'top' at the moment where a call from the other process arrived 5
+sec ago, stays like this for a while:
+
+last pid: 14610;  load averages:  0.05,  0.04,  0.03                   08:14:15
+58 processes:  54 sleeping, 1 running, 2 zombie, 1 on cpu
+CPU states:  0.0% idle,  3.4% user,  3.0% kernel, 93.6% iowait,  0.0% swap
+Memory: 256M real, 380M swap in use, 553M swap free
+
+  PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
+ 8492 vs750     22  58    0  342M  204M run    16:39  5.97% mono
+14610 vs750      1  58    0 1008K  760K sleep   0:00  0.04% sleep
+ 2229 root      12  58    0 2536K 1832K sleep   0:17  0.03% mibiisa
+  167 root       5  50    0 3104K 1248K sleep   0:00  0.02% automountd
+ 2522 vs750      1  58    0 1880K  920K sleep   0:05  0.00% waiter.csh
+ 2333 vs750      1  59    0   18M   58M sleep   0:03  0.00% Xsun
+ 8348 vs750      1  39   10 3664K 1552K sleep   0:01  0.00% xlock
+ 8493 vs750      3  58    0 8392K 1000K sleep   0:01  0.00% mono
+    1 root       1  58    0  800K  144K sleep   0:01  0.00% init
+14572 vs750      1  59    0 2640K  696K cpu     0:00  0.00% top
+ 2328 vs750      1   0    0 1152K    0K sleep   0:00  0.00% openwin
+   52 root       5   1    0 1352K  568K sleep   0:00  0.00% syseventconfd
+ 2207 vs750      1  10    0 1896K    0K sleep   0:00  0.00% csh
+ 2202 root       5  24    0 3272K 1200K sleep   0:00  0.00% dmispd
+14531 root       1  29    0 1832K 1120K sleep   0:00  0.00% in.telnetd
+
+please tell me how to give you more usefull information.
+the program is still running so maybe i can get more info out of it if you
+tell me how.