caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan T Bryant <jtbryant@valdosta.edu>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Closer on the Mysterious bug
Date: Sun, 11 Dec 2005 23:27:09 -0500 (EST)	[thread overview]
Message-ID: <7436506.1134361629559.JavaMail.jtbryant@valdosta.edu> (raw)

Wait.  Got it.  One pitfall of the native code compilers:  they don't 
check for stack overflow.  It just turns into a segfault.  When 
compiled to bytecode it crashed with a Stack_overflow exception.  I 
figured this out by chance: I ran into the same problem on another 
program and made the connection...

Jonathan T Bryant wrote:


>Everyone,
>
>Now I've fixed the Unix_error(12, "accept, "") bug: I thought passing 0 
>to select made in wait indefinitely, so I inadvertently created a race 
>condition.  I set it to 0 on all of the calls and that bug disappeared. 
> Also, I'm catching all of the exceptions and printing out a message 
>when I do, but they are closing as (or, for that matter, when) 
>expected.  All that's left is the segfault.  It still occurs at random 
>times: sometimes before any connections are established, sometimes 
>after all the connections have terminated, and sometimes right in the 
>middle.  Sometimes it even freezes for a moment (about 2 sec) before it 
>crashes.  GDB says the segfault is comming from fdset_to_fdlist(), 
>which leads me to Unix.select.  Here's the source of that C function 
>since not everybody will have the same version of OCaml as me (OCaml 
>3.08.3):
>
>static value fdset_to_fdlist(value fdlist, fd_set *fdset)
>{
>  value l;
>  value res = Val_int(0);
>
>  Begin_roots2(l, res);
>    for (l = fdlist; l != Val_int(0); l = Field(l, 1)) {
>      int fd = Int_val(Field(l, 0));
>      if (FD_ISSET(fd, fdset)) {
>        value newres = alloc_small(2, 0);
>        Field(newres, 0) = Val_int(fd);
>        Field(newres, 1) = res;
>        res = newres;
>      }
>    }
>  End_roots();
>  return res;
>}
>
>Any ideas?
>
>BTW, If you need to look at my updated code, it's available at 
>http://jonboy.isa-geek.com/
>
>--Jonathan
>
>-----------------------
>--Jonathan Bryant
>  jtbryant@valdosta.edu
>  AIM: JonBoy3182
>
>  OAS AAS LLS
>  ZG214
>
>_______________________________________________
>Caml-list mailing list. Subscription management:
>http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>Archives: http://caml.inria.fr
>Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>Bug reports: http://caml.inria.fr/bin/caml-bugs
>

-----------------------
--Jonathan Bryant
  jtbryant@valdosta.edu
  AIM: JonBoy3182

  OAS AAS LLS
  ZG214


                 reply	other threads:[~2005-12-12  4:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7436506.1134361629559.JavaMail.jtbryant@valdosta.edu \
    --to=jtbryant@valdosta.edu \
    --cc=caml-list@yquem.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).