From: Alessandro Baretta <alex@baretta.com>
To: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Client/Server socket communication
Date: Wed, 18 Sep 2002 10:23:18 +0200 [thread overview]
Message-ID: <3D8837F6.3060207@baretta.com> (raw)
In-Reply-To: <20020918031351.4EC427F4F@lobus.fungible.com>
Tim Freeman wrote:
>>Why "server <defunct>" is occurred.
>>What do I have to do to correct <defunct> ?
>
>
> This is a Unix thing, not an OCAML thing. The child will be defunct
> to hold the exit status so it can be reported to the parent when the
> parent waits for it, or until the parent exits.
>
> One workaround is to wait for the child process when you expect it to exit.
>
> Another workaround is to fork twice, so the original process is the
> parent of a temporary process, and the temporary process is the parent
> of the process you really wanted to create. The temporary process
> exits immediately and the original parent waits for it immediately.
> This leaves no defunct processes.
>
A third workaround might be to use SIGCHLD handler to
asynchronously call wait or waitpid, but there might be
issues with the non-reentrance-with-respect-to-signals of
the libc. I doubt O'Caml could be any more signal-safe than
libc.
A fourth workaround is to use O'Caml threads, which do not
require the kernel to instantiate a new process, so no new
pid is allocated.
Alex
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2002-09-18 8:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-18 2:51 IKEDA Katsumi
2002-09-18 3:07 ` Tim Freeman
2002-09-18 4:04 ` IKEDA Katsumi
2002-09-18 19:27 ` Tim Freeman
2002-09-19 1:52 ` IKEDA Katsumi
2002-09-18 8:23 ` Alessandro Baretta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D8837F6.3060207@baretta.com \
--to=alex@baretta.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).