[Mono-list] error of remoting

Lluis Sanchez lluis@ideary.com
Thu, 10 Jul 2003 13:07:03 +0200


Hi

StopListening won't work because in calls Thread.Abort which is not
implemented in Windows yet. Regarding the other error message about
mono_g_hash_table_remove, can you please file a bug in bugzila?

Thanks!

Lluis.

----- Original Message ----- 
From: "Wei Lu" <weilu@21cn.com>
To: <mono-list@lists.ximian.com>
Sent: Thursday, July 10, 2003 10:28 AM
Subject: [Mono-list] error of remoting


> Hi there,
>
> I have a problem on mono Remoting.
> For this program:
>
> //mcs -r:ServerObject.dll -r:System.Runtime.Remoting.dll RemotingServer.cs
> using System;
> using System.Runtime.Remoting;
> using System.Runtime.Remoting.Channels;
> using System.Runtime.Remoting.Channels.Tcp;
>
> namespace RemotingTest
> {
>         class RemotingServer
>         {
>                 static int Main ()
>                 {
>                         Console.WriteLine("Starting Server");
>                         TcpChannel ch = new TcpChannel(1122);
>                         ChannelServices.RegisterChannel (ch);
>
>                         ServerList ser = new ServerList();
>                         RemotingServices.Marshal(ser,"test.rem");
>
>                         Console.WriteLine("Server Running ...");
>                         Console.ReadLine();
>
>                         ch.StopListening (null);
>
>                         return 0;
>                 }
>         }
> }
>
> it runs well. but when i press enter to terminate it, even without any
client access ever, an error dialog pops:
> *** ERROR ***: file threads.c: line 885
(ves_icall_System_Threading_Thread_Abort): should not be reached aborting...
>
> if i comment the line: ch.StopListening (null);
> the error message in console becomes:
> ** (remotingserver.exe:18668): CRITICAL **: file mono-hash.c: line 396
(mono_g_h
> ash_table_remove): assertion `hash_table != NULL' failed
>
> this is what i'm using:
> Mono JIT compiler version 0.25, (C) 2002, 2003 Ximian, Inc.
> on Windows 2000 Pro SP3.
>
> The ServerObject used in above problem is as follows.
>
> //mcs -t:library ServerObject.cs
> using System;
> using System.Runtime.Remoting;
> using System.Collections;
>
> namespace RemotingTest
> {
>         // A list of ServerObject instances
>
>         public class ServerList: MarshalByRefObject
>         {
>                 ArrayList values = new ArrayList();
>
>                 public void Add (ServerObject v)
>                 {
>                         values.Add (v);
>                         System.Console.WriteLine ("Added " + v.Name);
>                 }
>
>                 public void ProcessItems ()
>                 {
>                         System.Console.WriteLine ("Processing...");
>
>                         int total = 0;
>                         foreach (ServerObject ob in values)
>                                 total += ob.GetValue();
>
>                         System.Console.WriteLine ("Total: " + total);
>                 }
>
>                 public void Clear()
>                 {
>                         values.Clear();
>                 }
>
>                 public ServerObject NewItem(string name)
>                 {
>                         ServerObject obj = new ServerObject(name);
>                         Add (obj);
>                         return obj;
>                 }
>
>                 public ComplexData SetComplexData (ComplexData data)
>                 {
>                         System.Console.WriteLine ("Showing content of
ComplexData");
>                         data.Dump ();
>                         return data;
>                 }
>         }
>
>         // A remotable object
>
>         public class ServerObject: MarshalByRefObject
>         {
>                 int _value;
>                 string _name;
>
>                 public ServerObject (string name)
>                 {
>                         _name = name;
>                 }
>
>                 public string Name
>                 {
>                         get { return _name; }
>                 }
>
>                 public void SetValue (int v)
>                 {
>                         System.Console.WriteLine ("ServerObject " + _name
+ ": setting " + v);
>                         _value = v;
>                 }
>
>                 public int GetValue ()
>                 {
>                         System.Console.WriteLine ("ServerObject " + _name
+ ": getting " + _value);
>                         return _value;
>                 }
>         }
>
>         // Some complex data for testing serialization
>
>         public enum AnEnum { a,b,c,d,e };
>
>         [Serializable]
>         public class ComplexData
>         {
>                 public AnEnum Val = AnEnum.a;
>                 public object[] Info;
>
>                 public ComplexData (AnEnum va, object[] info)
>                 {
>                         Info = info;
>                         Val = va;
>                 }
>
>                 public void Dump ()
>                 {
>                         System.Console.WriteLine ("Content:");
>                         System.Console.WriteLine ("Val: " + Val);
>                         foreach (object ob in Info)
>                                 System.Console.WriteLine ("Array item: " +
ob);
>                 }
>         }
> }
>
> Anyone knows why? Thank you!
>
> Sincerely,
>
> Wei Lu
> wlu@21cn.com
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>