You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3740 Reporter: administrator Status: closed (set by @xavierleroy on 2006-06-17T10:45:36Z) Resolution: unable to duplicate Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
These things always happen on the last day before the vacation, when
the prototype must definitely work and you have no time to find a
minimal example...
I am writing a cgi program, which contains code like the following
(only more complicated, ix is really a struct containing among other
things a Netcgi.cgi_activation and a Postgresql.connection. cols
contains records, not just simple strings and table
has far more fields (16)). Parts use the same function in place of the
do_something in the example (camlTable__save_show in the backtrace
below) with different tables. All parts have worked during various
stages of development, some work even now, but in some places I get a
segfault after the program writes AA to stderr.
type table = {
txt: string;
do_it: int -> string -> unit;
cols: string array;
}
let do_something t ix s =
prerr_endline "AA";
let n = Array.length t.cols in
prerr_endline "BB";
Printf.printf "%s\n" t.txt;
for i = 0 to n - 1 do
Printf.printf "%d %d %s %s\n" ix i t.cols.(i) s
done
let rec t0 = {
txt = "Foo";
do_it = (fun ix s -> do_something t0 ix s);
cols = [| "a"; "b"; "c" |];
}
let rec t = {
t0 with
do_it = (fun ix s -> do_something t ix s);
cols = [| "A"; "B";|];
}
let _ =
t.do_it 1 "s"
Here is a part of the apache logfile I get if I wrap my program in a
skript that calls it through gdb -batch:
AA
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182915746208 (LWP 11161)]
0x0000000000419434 in camlTable__save_391 ()
#0 0x0000000000419434 in camlTable__save_391 () #1 0x0000000000000000 in ?? () #2 0x00000000004d2b74 in caml_flush () #3 0x00000000004d338e in caml_ml_flush () #4 0x0000000000000000 in ?? () #5 0x0000002a96a4c980 in ?? () #6 0x0000000000419743 in camlTable__save_show_403 () #7 0x0000002a96a4b2c0 in ?? () #8 0x0000000000000000 in ?? () #9 0x0000002a96a4c980 in ?? ()
Same thing if I compile to bytecode:
AA
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182917156976 (LWP 11770)]
0x0000000000428b28 in caml_interprete ()
#0 0x0000000000428b28 in caml_interprete () #1 0x000000000042a772 in caml_main () #2 0x000000000041a268 in main ()
In one case, the working version is
let rec table' = {
table with
save = (fun rq x_id -> save_user {table with cols=cols'} rq x_id);
}
while this segfaults:
let rec table' = {
table with
save = (fun rq x_id -> save_user table' rq x_id);
cols=cols'
}
I can live with the extra allocation on every invocation of
table'.save to get things running, but it is a bit annoying.
The text was updated successfully, but these errors were encountered:
Original bug ID: 3740
Reporter: administrator
Status: closed (set by @xavierleroy on 2006-06-17T10:45:36Z)
Resolution: unable to duplicate
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Florian Hars
Version: 3.08.3 (from godi)
OS: linux/amd64
Submission from: dialin-145-254-038-023.arcor-ip.net (145.254.38.23)
These things always happen on the last day before the vacation, when
the prototype must definitely work and you have no time to find a
minimal example...
I am writing a cgi program, which contains code like the following
(only more complicated, ix is really a struct containing among other
things a Netcgi.cgi_activation and a Postgresql.connection. cols
contains records, not just simple strings and table
has far more fields (16)). Parts use the same function in place of the
do_something in the example (camlTable__save_show in the backtrace
below) with different tables. All parts have worked during various
stages of development, some work even now, but in some places I get a
segfault after the program writes AA to stderr.
type table = {
txt: string;
do_it: int -> string -> unit;
cols: string array;
}
let do_something t ix s =
prerr_endline "AA";
let n = Array.length t.cols in
prerr_endline "BB";
Printf.printf "%s\n" t.txt;
for i = 0 to n - 1 do
Printf.printf "%d %d %s %s\n" ix i t.cols.(i) s
done
let rec t0 = {
txt = "Foo";
do_it = (fun ix s -> do_something t0 ix s);
cols = [| "a"; "b"; "c" |];
}
let rec t = {
t0 with
do_it = (fun ix s -> do_something t ix s);
cols = [| "A"; "B";|];
}
let _ =
t.do_it 1 "s"
Here is a part of the apache logfile I get if I wrap my program in a
skript that calls it through gdb -batch:
AA
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182915746208 (LWP 11161)]
0x0000000000419434 in camlTable__save_391 ()
#0 0x0000000000419434 in camlTable__save_391 ()
#1 0x0000000000000000 in ?? ()
#2 0x00000000004d2b74 in caml_flush ()
#3 0x00000000004d338e in caml_ml_flush ()
#4 0x0000000000000000 in ?? ()
#5 0x0000002a96a4c980 in ?? ()
#6 0x0000000000419743 in camlTable__save_show_403 ()
#7 0x0000002a96a4b2c0 in ?? ()
#8 0x0000000000000000 in ?? ()
#9 0x0000002a96a4c980 in ?? ()
Same thing if I compile to bytecode:
AA
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 182917156976 (LWP 11770)]
0x0000000000428b28 in caml_interprete ()
#0 0x0000000000428b28 in caml_interprete ()
#1 0x000000000042a772 in caml_main ()
#2 0x000000000041a268 in main ()
In one case, the working version is
let rec table' = {
table with
save = (fun rq x_id -> save_user {table with cols=cols'} rq x_id);
}
while this segfaults:
let rec table' = {
table with
save = (fun rq x_id -> save_user table' rq x_id);
cols=cols'
}
I can live with the extra allocation on every invocation of
table'.save to get things running, but it is a bit annoying.
The text was updated successfully, but these errors were encountered: