DRb and Exceptions when using DRbUndumped

Hi all,

I have an object that lives in a server process (it includes DRbUndumped) and
responds to requests from clients. What I would like to do is to be able to
raise an exception from one of the server methods, and have that exception
caught in the client process.

What appears to happen at the moment is that as soon as the server method
raises an exception, the client’s connection to it is closed - the client
receives a “#<DRb::DRbConnError: connection closed>”.

Ideally I’d like the exception to be transported to the client and then raised
there - i do not want the connection to be closed. Is that doable or do I
need to avoid the use of exceptions from my “exported” methods?

TIA
Martin

···


Martin Hart
martin@zsdfherg.com

Hi,

From: “Martin Hart” martin@zsdfherg.com
Sent: Wednesday, January 14, 2004 3:41 AM

Ideally I’d like the exception to be transported to the client and then raised
there - i do not want the connection to be closed. Is that doable or do I
need to avoid the use of exceptions from my “exported” methods?

Must be doable. Can you post the code?

Running ruby with -d option might help to know what is going on.

Regards,
// NaHi

Hi,

From: “Martin Hart” martin@zsdfherg.com
Sent: Wednesday, January 14, 2004 3:41 AM

Ideally I’d like the exception to be transported to the client and then
raised there - i do not want the connection to be closed. Is that doable
or do I need to avoid the use of exceptions from my “exported” methods?

Must be doable. Can you post the code?

Running ruby with -d option might help to know what is going on.

ok - first off I am using drb 2.0.4 with ruby 1.6.8

My tests have revealed the following…

raising a class that derives from ::Exception calls the server to close
connection, but raising a class that derives from ArgumentError, TypeError,
StandardError, etc does not.

to work around the problem all i had to do was change my exception classes to
inherit from StandardError and not Exception.

I had a quick look through drb.rb and do in fact see that the drb code does
not specifically “rescue Exception”, and that appears to have been the cause
of my problem.

I can post code to reproduce if you really want it - but now I have a
workaround I am not all that worried (unless of course my diagnosis is
incorrect :slight_smile:

thanks for your help anyway,

cheers
Martin

···

On Thursday 15 January 2004 06:00, NAKAMURA, Hiroshi wrote:

Regards,
// NaHi