--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Han Holl (han.holl / pobox.com) wrote:

> Eric Hodel <drbrain / segment7.net> wrote in message news:<20040618220336.GK96045 / segment7.net>...
>  [ cut ]
> > This is an example of what not to do:
> > 
> > class RemoteObj
> >   include DRbUndumped
> >   ...
> > end
> > 
> > class Server
> >   def get resource
> >     return RemoteObj.new
> >   end
> > end
> > 
> > DRb.start service nil, Server.new
> > 
> > You could extend DRb::TimerIdConv to delay shutting down the DRb server
> > until after all remote objects expire.  Unfortunately, this brings you
> > to the choice of either waiting a long time to complete application
> > shutdown, or shutting down before the client processes are done with the
> > references.
> 
> In practice all clients fetch the results immediately, so it seemed to work
> fine, but I want something safer. Maybe creating a dumpable PGresult is the
> easiest way to go, but TimerIdConv with a short timeout would also work.
> I wonder what happens if a client references a CG removed object: it this
> is well-defined I could also re-issue the query in a rescue. The chance
> of this happening is quite small after all.

ObjectSpace._id2ref will raise a RangeError if you attempt to access a
recycled object:

RangeError: 0x4094880 is recycled object

I forget what you get back via DRb when your remote reference has
expired, though.  (You should be able to use the example above to find
out.)

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--a8Wt8u1KmwUX3Y2C
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFA1zKAMypVHHlsnwQRAq46AKCcLsa1M0GBsEuL/2ytVCIZsKUWtwCg70vb
CwMt9hpCDG4xCJnsHTCiQvg߳r
-----END PGP SIGNATURE-----

--a8Wt8u1KmwUX3Y2C--