caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Cezary Kaliszyk <ck189400@zodiac.mimuw.edu.pl>
To: caml-list@inria.fr
Subject: [Caml-list] Ocaml 3.06 bug
Date: Fri, 20 Sep 2002 15:47:21 +0200	[thread overview]
Message-ID: <20020920134721.GA19681@zodiac.mimuw.edu.pl> (raw)

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]


Concerning Ocaml version 3.06 on i686/Linux

There is a bug in the Unix library, which makes my program exit with
no warning message.

It happens when I call Unix.write two times on a descriptor closed
by the other side.

When I connect to the server and close the connection during 5 seconds
(ie using telnet) the server somehow exits the 'while true do'. The first
write is ok, the second exits the program.

Putting a "try .. with _ -> ()" inside the loop doesn't correct it.

It works the same way when compiled with ocamlc and ocamlopt.

The maximally simplifided server code producing the error:


open Unix;;
let addr = ADDR_INET (inet_addr_any, 1717);;
let sock = socket PF_INET SOCK_STREAM 0;;
bind sock addr;
listen sock 10;
while true do
  let (desc,caller) = accept sock in sleep 5;
  let _ = write desc "asd" 0 3 in
  let _ = write desc "qwe" 0 3 in ()
done;;


-- 

[-- Attachment #2: Type: application/pgp-signature, Size: 254 bytes --]

             reply	other threads:[~2002-09-23  4:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-20 13:47 Cezary Kaliszyk [this message]
2002-10-01  9:57 ` Xavier Leroy
2002-10-01 16:53   ` Thaddeus L. Olczyk
2002-10-01 17:41     ` Luc Maranget

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=20020920134721.GA19681@zodiac.mimuw.edu.pl \
    --to=ck189400@zodiac.mimuw.edu.pl \
    --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).