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
Mysterious bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-11 (11:12)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] Mysterious bug
 Jonathan Bryant [Saturday 10 December 2005] :
 > Everybody,
 > I'm working on my client/server library and I've run into a rather
 > elusive bug.  It may be elusive because my skills with GDB are rather
 > shoddy (usually I'm pretty good at achieving my goal of not needing to
 > use it).
 > The attachment is my code for the library (as well as a small build
 > script and tester).  It's documented in the Acceptor module, but when I
 > run the server under high loads (10 thread pinging it 1,000,000 times or
 > so each), one of three things happens:
 > 1. Nothing (works like it should)
 > 2. Unix.accept raises an Unix.Unix_error(12, "accept", "") at some
 > random time (sometimes, I believe, after all of the connections have
 > been made, but I feel very wrong in thinking this)

12 is EINVAL, and the accept(2) manpage says:

  EINVAL Socket is not listening for connections.

So I guess your code has some ordering issues, you accept()
either before you listen() or after you shutdown().