caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ocaml 3.06 bug
@ 2002-09-20 13:47 Cezary Kaliszyk
  2002-10-01  9:57 ` Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Cezary Kaliszyk @ 2002-09-20 13:47 UTC (permalink / raw)
  To: caml-list

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-01 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-20 13:47 [Caml-list] Ocaml 3.06 bug Cezary Kaliszyk
2002-10-01  9:57 ` Xavier Leroy
2002-10-01 16:53   ` Thaddeus L. Olczyk
2002-10-01 17:41     ` Luc Maranget

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