Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Ocaml 3.06 bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-23 (04:41)
From: Cezary Kaliszyk <ck189400@z...>
Subject: [Caml-list] Ocaml 3.06 bug

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