[IronPython] Sandbox AppDomains and 'Object has been disconnected or does not exist at the server' exceptions
Patrick van der Willik
patrick at toolmaker.nl
Sat Jun 27 01:36:23 CEST 2009
It took me a few hours of reading documentation, but I figured out a fix
for myself earlier today but never had the chance to send the mail
around with my own fix. My own fix means overloading
InitializeLifetimeService() on all MarshalByRefObjects and have it
return null. This will work perfectly for class variables which are
passed cross appdomain. I have several classes which were passed cross
appdomain and are kept around for as long as the applications runs.
Your explanation is in this matter correct. Remoting keeps GC references
around for 5 minutes by default. After 5 minutes of no method calls on
the object, the GC thinks the object is no longer used and disposes of
it. The whole reason for this is because object pinging would case a
massive amount of traffic and depending on objects to report their
destruction isn't reliable.
Basically, the solution is to add this to all classes that are passed
over AppDomain boundaries:
public override object InitializeLifetimeService()
Patrick van der Willik
Dino Viehland wrote:
> Tomas has checked in a fix for this. Basically what's going on is
> that w/ remoting you have a lease which keeps the remote objects
> alive. If that lease expires (by default it's 5 or 15 minutes or
> something) then the object becomes unreachable. The fix was to
> opt-out of the leasing system. Long term we need a better story
> around the lease but it'll prevent this from happening for the time being.
> *From:* users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] *On Behalf Of *Patrick van
> der Willik
> *Sent:* Wednesday, June 24, 2009 6:52 PM
> *To:* Discussion of IronPython
> *Subject:* [IronPython] Sandbox AppDomains and 'Object has been
> disconnected or does not exist at the server' exceptions
> I isolated my IPy instance into a seperate AppDomain with some serious
> restrictions on which assemblies are allowed to be loaded. In the
> current setup it's impossible to open sockets or read files from disk,
> which is exactly what I'm trying to accomplish.
> However, when my server is idle for a few minutes(or more simple, when
> I put my laptop into hibernation and resume it later that day), the
> connection with the appdomain seems to time out. When calling a
> function it'll throw an exception with the following message:
> has been disconnected or does not exist at the server."
> I'm not really sure how I need to solve this one. Research showed that
> it probably has to do with Remoting.
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users