[Mono-list] re moting lifetime problem

semichel inschenjoer at gmx.de
Thu Oct 2 11:07:47 EDT 2008


Hello,

I have a client/server program with the followin architecture.

1. The server program contains a singleton SessionFactory class. The return
value of InitializeLifeTime is null to live forever. There is a login method
that returns a SessionObject to the client.

2. The InitializeLifeTime function of the SessionObject is defined as:

            ILease lease = (ILease)base.InitializeLifetimeService();
            if (lease.CurrentState == LeaseState.Initial)
            {
                lease.InitialLeaseTime = TimeSpan.FromMinutes(5);
                lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
                lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
            }
            return lease;

3. The client program contains an AppClient class, that requests the
SessionFactory instance from the server and logs in. After this it adds a
ClientSponsor to the SessionObject:

                m_session = m_factory.Login(username, password);

                ClientSponsor client_sponsor = new
ClientSponsor(TimeSpan.FromMinutes(10));
                ILease lease =
(ILease)RemotingServices.GetLifetimeService(m_session);
                lease.Register(client_sponsor);


The behaviour of the SessionObjects on the serverside is different on .Net
on windows and mono on linux. After I close the clients, the SessionObjects
should get disconnected.

WINDOWS:

0, 02.10.2008 12:53:35: SessionFactory was marshaled.
Press the enter key to exit...
1, 02.10.2008 12:53:59: SessionObject was marshaled.
1, 02.10.2008 12:53:59: AppClient was unmarshaled.
1, 02.10.2008 12:53:59: Lease was marshaled.
1, 02.10.2008 12:53:59: ClientSponsor was unmarshaled.
SessionObject.Dispose()
2, 02.10.2008 12:54:04: SessionObject was marshaled.
2, 02.10.2008 12:54:04: AppClient was unmarshaled.
2, 02.10.2008 12:54:04: Lease was marshaled.
2, 02.10.2008 12:54:04: ClientSponsor was unmarshaled.
SessionObject.Dispose()
2, 02.10.2008 12:59:09: Lease was marshaled.
2, 02.10.2008 12:59:11: Lease was marshaled.
1, 02.10.2008 12:59:11: SessionObject was disconnected.
1, 02.10.2008 12:59:11: Lease was disconnected.
0, 02.10.2008 12:59:13: SessionObject was disconnected.
0, 02.10.2008 12:59:13: Lease was disconnected.

LINUX:

debian:/opt/Soma# mono ./Server.exe
0, 02.10.2008 12:47:59: SessionFactory was marshaled.
Press the enter key to exit...
1, 02.10.2008 12:48:01: SessionObject was marshaled.
1, 02.10.2008 12:48:01: AppClient was unmarshaled.
1, 02.10.2008 12:48:01: Lease was marshaled.
1, 02.10.2008 12:48:01: ClientSponsor was unmarshaled.
SessionObject.Dispose()
2, 02.10.2008 12:48:06: SessionObject was marshaled.
2, 02.10.2008 12:48:06: AppClient was unmarshaled.
2, 02.10.2008 12:48:07: Lease was marshaled.
2, 02.10.2008 12:48:07: ClientSponsor was unmarshaled.
SessionObject.Dispose()
2, 02.10.2008 12:53:01: Lease was marshaled.
2, 02.10.2008 12:56:10: Lease was marshaled.


The first number, is the number of connected clients.

As you can see, the SessionObjects in Windows will be disconnected. When
running in Mono, the objects live forever and a lease will be marshalled.

Here is the mono version.

debian:~# mono -V
Mono JIT compiler version 1.9.1 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC)
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none


Can somebody help me with his?

bye
Sebastian
-- 
View this message in context: http://www.nabble.com/remoting-lifetime-problem-tp19777368p19777368.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list