demexp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Demexp-dev] Re: [RPC] Exception on invalid input: bug or feature?


From: David MENTRE
Subject: [Demexp-dev] Re: [RPC] Exception on invalid input: bug or feature?
Date: Fri, 11 Feb 2005 17:44:55 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hello Gerd,

Gerd Stolpmann <address@hidden> writes:

> The exception Cannot_represent is raised when the message contains an
> integer that cannot be represented as O'Caml value. For example, when
> the message includes large unsigned ints that are outside of the valid
> range of the O'Caml int type. (In your case the problem is apparently
> that a field in the message header is outside of the valid range.)
>
> This means that such messages are valid, but there is no way to
> represent them as O'Caml values.

Or message is invalid (as when I enter garbage input in the
socket).

> In my opinion, it is best to handle
> them as invalid messages, i.e. just drop them.

Thank you for the explanation. And I agree with you that I'd rather
handle them as invalid.

> Because they cannot be decoded, the callback function is not called. The
> session filter is invoked before message decoding starts, so there is no
> chance that the session filter can handle the problem.
>
> I propose you handle this type of exception by a loop around
> Unixqueue.run, e.g.
>
> let rec restartable_run uq =
>   try
>     Unixqueue.run uq
>   with
>     Cannot_represent ->
>       ...; (* maybe write in a log file *)
>       restartable_run uq

I have implemented this. [for demexp-dev people, this is in
demexp--cduce--0.3--patch-15]. 

> Normally this works. If you encounter problems, e.g. file descriptors
> not closed etc., let me know.

Ok. Right now, it seems to work and the sockets file descriptor are
correctly closed. I'll let you know if I find further issue.

Many thanks for the answer,
Yours,
david
-- 
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A






reply via email to

[Prev in Thread] Current Thread [Next in Thread]