caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Assertion failure in ocamlrund
@ 2005-05-27 19:26 Sami Liedes
  2005-05-27 21:13 ` [Caml-list] " Damien Doligez
  2005-05-31  1:15 ` Sami Liedes
  0 siblings, 2 replies; 4+ messages in thread
From: Sami Liedes @ 2005-05-27 19:26 UTC (permalink / raw)
  To: caml-list

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

Hi,

After having ocamlrun segfault on my program (only when running with
OCAMLRUNPARAM=b, without b it reports an uncaught Not_found exception)
I compiled the debugging version of it, and this is what I get:

file freelist.c; line 123 ### Assertion failed: wo_sz >= 1

Here's a backtrace:

#0  caml_failed_assert (expr=0x806f000 "wo_sz >= 1", file=0x806ee80 "freelist.c", line=123) at misc.c:25
#1  0x08067b24 in caml_fl_allocate (wo_sz=0) at freelist.c:123
#2  0x080504d3 in caml_alloc_shr (wosize=0, tag=1) at memory.c:261
#3  0x0806955a in caml_oldify_one (v=134801368, p=0xb798ebf0) at minor_gc.c:94
#4  0x0806997a in caml_oldify_mopup () at minor_gc.c:171
#5  0x08069a17 in caml_empty_minor_heap () at minor_gc.c:193
#6  0x08069ae8 in caml_minor_collection () at minor_gc.c:222
#7  0x08055b4e in caml_array_unsafe_get_float (array=-1210587644, index=17) at array.c:92
#8  0x08055bc5 in caml_array_unsafe_get (array=-1210587644, index=17) at array.c:102
#9  0x0806592b in caml_interprete (prog=0xb7df9008, prog_size=149264) at interp.c:874
#10 0x080676b3 in caml_main (argv=0xbffff754) at startup.c:404
#11 0x0804fe7f in main (argc=2, argv=0xbffff754) at main.c:35

I have put the backtrace with values of all locals (ie. gdb "bt full"
output) at

  http://baron.tky.hut.fi/ocamlrund-bt.full.txt

for your convenience.

Although this happens randomly, it does happen often enough so I can
reproduce it. So please ask me for more debugging information such as
contents of some heap variables if you feel it might be useful.

Lastly, here's a snippet of ocamlrund output before the crash (from a
different run). From it seems something in the bytecode program gets
crazy. There's nothing in it that should start to allocate memory like
that; it would be nice to get a backtrace though to diagnose the
problem, but I can't get it with either OCAMLRUNPARAM=b or with
ocamldebug, which seems to be confused by vmthreads or something in
the very beginning of the bytecode program[1].

------------------------------
### O'Caml runtime: heap check ###
!Growing heap to 480k bytes
<>$<>$Starting new major GC cycle
### O'Caml runtime: heap check ###
Compacting heap...
### O'Caml runtime: heap check ###
Shrinking heap to 240k bytes
done.
<>Starting new major GC cycle
### O'Caml runtime: heap check ###
!<Growing heap to 2300k bytes
Growing page table to 738 entries
Growing heap to 2540k bytes
Growing page table to 800 entries
Growing heap to 8776k bytes
Growing page table to 2361 entries
Growing heap to 20544k bytes
Growing page table to 5305 entries
file freelist.c; line 123 ### Assertion failed: wo_sz >= 1
------------------------------

	Sami

[1] shortly after "run" ocamldebug just breaks into the prompt without
    any message at all, which I find confusing, but that's already
    another story

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

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

* Re: [Caml-list] Assertion failure in ocamlrund
  2005-05-27 19:26 Assertion failure in ocamlrund Sami Liedes
@ 2005-05-27 21:13 ` Damien Doligez
  2005-05-27 22:03   ` Sami Liedes
  2005-05-31  1:15 ` Sami Liedes
  1 sibling, 1 reply; 4+ messages in thread
From: Damien Doligez @ 2005-05-27 21:13 UTC (permalink / raw)
  To: Sami Liedes; +Cc: caml-list

On May 27, 2005, at 21:26, Sami Liedes wrote:

> file freelist.c; line 123 ### Assertion failed: wo_sz >= 1

Have you tried compiling without option -unsafe and using only the
safe versions of Array.get and Array.set?

Is your program pure OCaml without any C code?

If the answers are yes to both questions, I'd like to get a copy
of your source.

-- Damien


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

* Re: [Caml-list] Assertion failure in ocamlrund
  2005-05-27 21:13 ` [Caml-list] " Damien Doligez
@ 2005-05-27 22:03   ` Sami Liedes
  0 siblings, 0 replies; 4+ messages in thread
From: Sami Liedes @ 2005-05-27 22:03 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list

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

On Fri, May 27, 2005 at 11:13:15PM +0200, Damien Doligez wrote:

> Have you tried compiling without option -unsafe and using only the
> safe versions of Array.get and Array.set?
> 
> Is your program pure OCaml without any C code?

Yes, and yes. I don't use -unsafe, and assuming you mean the normal
Array.set and Array.get, I use them and never unsafe_get or
unsafe_set. No C code.

I compile and link everything with -thread or -vmthread and the only
non-default libs I link in are str, unix and threads.

I don't use Obj or Marshal.

> If the answers are yes to both questions, I'd like to get a copy
> of your source.

That is possible. However the program interfaces with a server written
in perl and I'll have to ask for permission to give its code to you -
it's probably quite hard to get the bug to happen without the server
program.

I assume I can get a permission within a day or at most two so I'll
get back to you then.

	Sami

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

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

* Re: [Caml-list] Assertion failure in ocamlrund
  2005-05-27 19:26 Assertion failure in ocamlrund Sami Liedes
  2005-05-27 21:13 ` [Caml-list] " Damien Doligez
@ 2005-05-31  1:15 ` Sami Liedes
  1 sibling, 0 replies; 4+ messages in thread
From: Sami Liedes @ 2005-05-31  1:15 UTC (permalink / raw)
  To: caml-list

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

On Fri, May 27, 2005 at 10:26:31PM +0300, Sami Liedes wrote:

> After having ocamlrun segfault on my program (only when running with
> OCAMLRUNPARAM=b, without b it reports an uncaught Not_found exception)
> I compiled the debugging version of it, and this is what I get:
> 
> file freelist.c; line 123 ### Assertion failed: wo_sz >= 1

Hi again,

I think I have narrowed down at least part of the problem now. It is
related to a file descriptor leak in the code; why this would cause
the above-mentioned assertion failure, I don't know, but I'd guess
it's not handled somewhere (symbol loading?).

Or perhaps that assertion failure is unrelated to the crash that
happens when running the non-debug version of ocamlrun with
OCAMLRUNPARAM=b. Somehow it seems that ocamlrund gets the assertion
failure _much_ quicker than the non-debug version segfaults.

Apparently this also causes the confusing claim by the runtime that in
the event of an unhandled exception a backtrace cannot be produced
because the program was compiled without debug symbols.

	Sami

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

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

end of thread, other threads:[~2005-05-31  1:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27 19:26 Assertion failure in ocamlrund Sami Liedes
2005-05-27 21:13 ` [Caml-list] " Damien Doligez
2005-05-27 22:03   ` Sami Liedes
2005-05-31  1:15 ` Sami Liedes

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