DRb and Exceptions when using DRbUndumped

M

Martin Hart

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
 
N

NAKAMURA, Hiroshi

Hi,
From: "Martin Hart" <[email protected]>
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
 
M

Martin Hart

Hi,


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 :)

thanks for your help anyway,

cheers
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top