List Info

Thread: "ocaml_beginners"::[] terminating code without message




"ocaml_beginners"::[] terminating code without message
user name
2008-03-26 03:04:00

Hello list,

I working on an ocaml code that is called from a shell script like this

./main.native >& $logfile

if [ $? -ne 0 ]; then
echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
fi

I see that the main.native terminates with not zero exit code but
there is no exception raised or at least no one is written to the log
file.

In the main.ml file there is a very secur solution

let _ =
at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
let _ =
try
doit ()
with any -> begin
Printf.eprintf "caught %sn. Reraise." (Printexc.to_string any);
flush_all ();
raise any
end in
()

If everything goes well "now exiting" is printed. But sometimes, my
program terminates without any message. I don't know whether it is the
problem of my program, problem of the ocaml runtime.

Has anybody any idea?

peter

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] terminating code without message
user name
2008-03-26 04:14:50

I forgot: ocaml returns a magic error code 141

peter

On Mar 26, 2008, at 9:04 AM, Peter Halacsy wrote:

> Hello list,
>
> I working on an ocaml code that is called from a shell script like
> this
>;
> ./main.native >& $logfile
>
>; if [ $? -ne 0 ]; then
>; echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
> fi
>
> I see that the main.native terminates with not zero exit code but
> there is no exception raised or at least no one is written to the log
> file.
>
> In the main.ml file there is a very secur solution
>
>;
> let _ =
> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>; let _ =
> try
> doit ()
> with any -> begin
> Printf.eprintf "caught %sn. Reraise." (Printexc.to_string any);
> flush_all ();
> raise any
> end in
> ()
>
>
> If everything goes well "now exiting" is printed. But sometimes, my
> program terminates without any message. I don't know whether it is the
> problem of my program, problem of the ocaml runtime.
>
>; Has anybody any idea?
>
> peter
>
> ------------------------------------
>
> Archives up to December 31, 2007 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can
> be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames
> etc.Yahoo! Groups Links
>
>
>

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] terminating code without message
user name
2008-03-28 08:38:39

Can anybody help me? I've found nothing about this kind of errors.

peter

On Mar 26, 2008, at 9:04 AM, Peter Halacsy wrote:

> Hello list,
>
> I working on an ocaml code that is called from a shell script like
> this
>;
> ./main.native >& $logfile
>
>; if [ $? -ne 0 ]; then
>; echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
> fi
>
> I see that the main.native terminates with not zero exit code but
> there is no exception raised or at least no one is written to the log
> file.
>
> In the main.ml file there is a very secur solution
>
>;
> let _ =
> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>; let _ =
> try
> doit ()
> with any -> begin
> Printf.eprintf "caught %sn. Reraise." (Printexc.to_string any);
> flush_all ();
> raise any
> end in
> ()
>
>
> If everything goes well "now exiting" is printed. But sometimes, my
> program terminates without any message. I don't know whether it is the
> problem of my program, problem of the ocaml runtime.
>
>; Has anybody any idea?
>
> peter
>
> ------------------------------------
>
> Archives up to December 31, 2007 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can
> be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames
> etc.Yahoo! Groups Links
>
>
>

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] terminating code without message
user name
2008-03-28 09:09:57

What is the non-zero exit code it's exiting with? I believe reraising 'any'
will cause the program to exit with code 2, but that doesn't explain why you
don't get the exception printed to your logfile.

Incedentally, you can shorten your main function to

let _ =
at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
Printexc.print doit ()
;;

It won't print the "caught:" and "Reraising" parts, but you'll still get the
idea.

On Fri, 28 Mar 2008 14:38:39 +0100, Peter Halacsy wrote
> Can anybody help me? I've found nothing about this kind of errors.
>
> peter
>
> On Mar 26, 2008, at 9:04 AM, Peter Halacsy wrote:
>
> > Hello list,
> >
>; > I working on an ocaml code that is called from a shell script like
> > this
>; >
>; > ./main.native >& $logfile
> >
>; > if [ $? -ne 0 ]; then
>; > echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
> > fi
> >
>; > I see that the main.native terminates with not zero exit code but
> > there is no exception raised or at least no one is written to the log
> > file.
> >
>; > In the main.ml file there is a very secur solution
> >
>; >
>; > let _ =
> > at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>; > let _ =
> > try
> > doit ()
> > with any -> begin
> > Printf.eprintf "caught %sn. Reraise." (Printexc.to_string any);
> > flush_all ();
> > raise any
> > end in
> > ()
> >
>; >
>; > If everything goes well "now exiting" is printed. But sometimes, my
> > program terminates without any message. I don't know whether it is the
> > problem of my program, problem of the ocaml runtime.
> >
>; > Has anybody any idea?
> >
>; > peter
> >
>; > ------------------------------------
> >
>; > Archives up to December 31, 2007 are also downloadable at
http://www.connettivo.net/cntprojects/ocaml_beginners/
> > The archives of the very official ocaml list (the seniors' one) can
> > be found at http://caml.inria.fr
> > Attachments are banned and you're asked to be polite, avoid flames
> > etc.Yahoo! Groups Links
> >
>; >
>; >
>;
> ------------------------------------
>
> Archives up to December 31, 2007 are also downloadable at
http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can
> be found at http://caml.inria.fr Attachments are banned and you're
> asked to be polite, avoid flames etc.Yahoo! Groups Links
>
>
>

--

William D. Neumann

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] terminating code without message
user name
2008-03-29 05:26:41


On Mar 28, 2008, at 3:09 PM, William D. Neumann wrote:

> What is the non-zero exit code it's exiting with?

141

> I believe reraising 'any'
> will cause the program to exit with code 2, but that doesn't explain
> why you
> don't get the exception printed to your logfile.
>

I think no exception is raised. This is strange.

> Incedentally, you can shorten your main function to
>
> let _ =
> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>; Printexc.print doit ()
> ;;
>

yes. thanks.

peter

> It won't print the "caught:" and "Reraising" parts, but you'll still
> get the
> idea.
>
> On Fri, 28 Mar 2008 14:38:39 +0100, Peter Halacsy wrote
>> Can anybody help me? I've found nothing about this kind of errors.
>>
>> peter
>>
>> On Mar 26, 2008, at 9:04 AM, Peter Halacsy wrote:
>>
>>> Hello list,
>>>
>>> I working on an ocaml code that is called from a shell script like
>;>> this
>;>>
>>> ./main.native >& $logfile
>>>
>>> if [ $? -ne 0 ]; then
>;>> echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
>>>; fi
>>>
>>> I see that the main.native terminates with not zero exit code but
>>> there is no exception raised or at least no one is written to the
>>;> log
>>> file.
>>>
>>> In the main.ml file there is a very secur solution
>>>
>>>
>>> let _ =
>>> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>;>> let _ =
>>> try
>>> doit ()
>>> with any -> begin
>>> Printf.eprintf "caught %sn. Reraise." (Printexc.to_string
>>;> any);
>>> flush_all ();
>>> raise any
>>> end in
>>> ()
>>>
>>>
>>> If everything goes well "now exiting" is printed. But sometimes, my
>>> program terminates without any message. I don't know whether it is
>>;> the
>>> problem of my program, problem of the ocaml runtime.
>>>
>>> Has anybody any idea?
>>>
>>> peter
>>>
>>> ------------------------------------
>>>
>>> Archives up to December 31, 2007 are also downloadable at
> http://www.connettivo.net/cntprojects/ocaml_beginners/
>>> The archives of the very official ocaml list (the seniors' one) can
>>> be found at http://caml.inria.fr
>>;> Attachments are banned and you're asked to be polite, avoid flames
>>> etc.Yahoo! Groups Links
>>>
>>>
>>>
>>
>> ------------------------------------
>>
>> Archives up to December 31, 2007 are also downloadable at
> http://www.connettivo.net/cntprojects/ocaml_beginners/
>> The archives of the very official ocaml list (the seniors' one) can
>> be found at http://caml.inria.fr Attachments are banned and you're
>> asked to be polite, avoid flames etc.Yahoo! Groups Links
>>
>>
>>
>
> --
>
> William D. Neumann
>
>
> ------------------------------------
>
> Archives up to December 31, 2007 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can
> be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames
> etc.Yahoo! Groups Links
>
>
>

__._,_.___
.

__,_._,___
sigpipe in ocamlnet / Was: "ocaml_beginners"::[] terminating code without message
user name
2008-03-30 08:18:49

I use netclient module of ocamlnet package. It turned out that under
some circumstances the op system sends a SIGPIPE signal but ocamlnet
do not catch it.

The shell terminates my ocaml program and adds 128 to the code of
unhandled signal. That's why I got the error code 141.

peter

On Mar 28, 2008, at 3:09 PM, William D. Neumann wrote:

> What is the non-zero exit code it's exiting with? I believe
> reraising 'any'
> will cause the program to exit with code 2, but that doesn't explain
> why you
> don't get the exception printed to your logfile.
>
>; Incedentally, you can shorten your main function to
>
> let _ =
> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>; Printexc.print doit ()
> ;;
>
> It won't print the "caught:" and "Reraising" parts, but you'll still
> get the
> idea.
>
> On Fri, 28 Mar 2008 14:38:39 +0100, Peter Halacsy wrote
>> Can anybody help me? I've found nothing about this kind of errors.
>>
>> peter
>>
>> On Mar 26, 2008, at 9:04 AM, Peter Halacsy wrote:
>>
>>> Hello list,
>>>
>>> I working on an ocaml code that is called from a shell script like
>;>> this
>;>>
>>> ./main.native >& $logfile
>>>
>>> if [ $? -ne 0 ]; then
>;>> echo "[`date +"%Y/%m/%d %H:%M";`] Error while running
>>>; fi
>>>
>>> I see that the main.native terminates with not zero exit code but
>>> there is no exception raised or at least no one is written to the
>>;> log
>>> file.
>>>
>>> In the main.ml file there is a very secur solution
>>>
>>>
>>> let _ =
>>> at_exit (fun () -> Printf.eprintf "now exitingn"; flush_all ());
>;>> let _ =
>>> try
>>> doit ()
>>> with any -> begin
>>> Printf.eprintf "caught %sn. Reraise." (Printexc.to_string
>>;> any);
>>> flush_all ();
>>> raise any
>>> end in
>>> ()
>>>
>>>
>>> If everything goes well "now exiting" is printed. But sometimes, my
>>> program terminates without any message. I don't know whether it is
>>;> the
>>> problem of my program, problem of the ocaml runtime.
>>>
>>> Has anybody any idea?
>>>
>>> peter
>>>
>>> ------------------------------------
>>>
>>> Archives up to December 31, 2007 are also downloadable at
> http://www.connettivo.net/cntprojects/ocaml_beginners/
>>> The archives of the very official ocaml list (the seniors' one) can
>>> be found at http://caml.inria.fr
>>;> Attachments are banned and you're asked to be polite, avoid flames
>>> etc.Yahoo! Groups Links
>>>
>>>
>>>
>>
>> ------------------------------------
>>
>> Archives up to December 31, 2007 are also downloadable at
> http://www.connettivo.net/cntprojects/ocaml_beginners/
>> The archives of the very official ocaml list (the seniors' one) can
>> be found at http://caml.inria.fr Attachments are banned and you're
>> asked to be polite, avoid flames etc.Yahoo! Groups Links
>>
>>
>>
>
> --
>
> William D. Neumann
>
>
> ------------------------------------
>
> Archives up to December 31, 2007 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
> The archives of the very official ocaml list (the seniors' one) can
> be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames
> etc.Yahoo! Groups Links
>
>
>

__._,_.___
.

__,_._,___
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )