| Anonymous | Login | Signup for a new account | 2013-05-22 03:23 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0002893 | OCaml | OCaml general | public | 2004-07-03 03:27 | 2007-12-06 15:34 | |||
| Reporter | administrator | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | ||||||||
| Target Version | Fixed in Version | 3.08.0 | ||||||
| Summary | 0002893: SEGV when using Gc.finalise | |||||||
| Description | Full_Name: Mike Furr Version: 3.07 & cvs-3.08 OS: OS X & linux Submission from: pcp01781388pcs.howard01.md.comcast.net (68.32.48.24) The program below segfaults on my mac and my linux box when compiled with either the native code or byte code compilers. I have observed this behavior in both 3.07 and the branch tagged release308 in CVS(7/2/04). This particular version of the program segv's on 3.08, but not 3.07, but I can supply a larger version which kills 3.07 if it would help(I tried to create the smallest test case to trigger it). I'm running Debian/unstable on my i386 linux box and OS X 10.2 on my mac. Note, while trying to slim down the program to submit, I got different backtraces from gdb along the way...so it seems that the stack is being smashed somewhere and thus I don't know how useful a bt would be, but here is one just in case: furrm@Kamino:~/devel/cache$ gdb ./test [...] This GDB was configured as "powerpc-apple-macos10". Reading symbols for shared libraries .. done (gdb) run Starting program: /Users/furrm/devel/cache/test [Switching to process 19826 thread 0xb03] Reading symbols for shared libraries .. done Program received signal EXC_BAD_ACCESS, Could not access memory. 0x00022608 in caml_fl_allocate () (gdb) bt #0 0x00022608 in caml_fl_allocate () #1 0x00015f70 in caml_alloc_shr () #2 0x0001f150 in caml_weak_create () 0000003 0x00013234 in caml_c_call () Cannot access memory at address 0x181 Here is the program: module H = struct type t = string let equal t1 t2 = (String.compare t1 t2 = 0) let hash = Hashtbl.hash end module Cache = Weak.Make (H) let final elt = () let cache = Cache.create 2047;; let _ = for i = 0 to 100000 do let v = String.create ((i mod 10)+1) in Gc.finalise final v; Cache.add cache v done Let me know if I can provide any other information. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0003080) administrator (administrator) 2004-07-03 12:04 |
> Full_Name: Mike Furr > Version: 3.07 & cvs-3.08 > The program below segfaults on my mac and my linux box when compiled with > either the native code or byte code compilers. I have observed this behavior in > both 3.07 and the branch tagged release308 in CVS(7/2/04). This particular > version of the program segv's on 3.08, but not 3.07, but I can supply a larger > version which kills 3.07 if it would help(I tried to create the smallest test > case to trigger it). Thanks for finding this bug. It is now fixed in the release308 branch. However, I'm still interested in a reproduction case for 3.07, since it seems to be a different bug. -- Damien |
|
(0003081) administrator (administrator) 2004-07-03 12:54 |
On Sat, 3 Jul 2004, Damien Doligez wrote: > Thanks for finding this bug. It is now fixed in the release308 branch. > However, I'm still interested in a reproduction case for 3.07, since it seems > to be a different bug. Attached. This program crashes on my mac with 3.07 and uses all available memory(1G) on my linux box. It appears to run correctly with 3.08alpha after your recent changes. -mike ---------------- open Printf type elt = { id : int; mutable life : int; data : string; } let uniq = ref 0;; module H = struct type t = elt let equal t1 t2 = t1.id = t2.id let hash t = Hashtbl.hash t.id end module Cache = Weak.Make (H) let keeparound = Hashtbl.create 127;; let cache = Cache.create 2047;; let mk num = incr uniq; {id = !uniq; life = 1; data = String.create ((num mod 10)+1); } let alarm () = Hashtbl.clear keeparound let rec final elt = if elt.life > 0 then begin (* Gc.finalise final elt *) elt.life <- elt.life - 1; Hashtbl.add keeparound elt elt.id; end else begin fprintf stderr "freeing %d\n" elt.id; flush stderr; end let _ = ignore(Gc.create_alarm alarm); let count = ref 0 in for i = 0 to 100000 do let v = mk i in Gc.finalise final v; (*Cache.add cache v -- segv's withor without this line *) done; Gc.full_major(); Gc.print_stat stdout ---------------- ---------------- |
|
(0003082) administrator (administrator) 2004-07-12 15:36 |
fixed for 3.08+alpha --DD 2004-07-03 can't reproduce crash on 3.07+2 uses all memory because of reentrancy into Hashtbl.resize |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:14 | administrator | New Issue | |
| 2007-12-06 15:34 | doligez | Status | acknowledged => closed |
| 2007-12-06 15:34 | doligez | Resolution | unable to reproduce => fixed |
| 2007-12-06 15:34 | doligez | Fixed in Version | => 3.08.0 |
| 2007-12-06 15:34 | doligez | Description Updated | |
| Copyright © 2000 - 2011 MantisBT Group |