Ticket #10 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

-r33351 causes tcl segfault

Reported by: coke Owned by:
Priority: major Milestone:
Component: none Version: trunk
Severity: high Keywords: segfault
Cc: Language:
Patch status: Platform: linux

Description

To duplicate the segfault, grab a copy of partcl ( http://code.google.com/p/partcl/wiki/PartclSource), and run:

../../parrot tcl.pbc library/tcltest/tcltest.tcl

Which should output nothing and complete successfully; Recent parrots segfault here (at least on feather.) using svn-bisect, I find this segfault began at r33351:

------------------------------------------------------------------------
r33351 | tewk | 2008-11-29 22:30:59 +0100 (Sat, 29 Nov 2008) | 2 lines

[nsentry] The infrastructure is in place, make realclean

------------------------------------------------------------------------

The backtrace is as follows:

#0  0xb7ac02d1 in string_equal (interp=0x804f040, s1=0x8a, s2=0x8070f20) at src/string.c:1437
#1  0xb7d971ac in ns_insert_sub_keyed_str (interp=0x804f040, self=0xb6471dbc, key=0xb634e500, value=0x82c31e4)
    at ./src/pmc/namespace.pmc:92
#2  0xb7d97c06 in Parrot_NameSpace_set_pmc_keyed_str (interp=0x804f040, pmc=0xb6471dbc, key=0xb634e500, value=0x82c31e4)
    at ./src/pmc/namespace.pmc:246
#3  0xb7b3fd5f in Parrot_set_global (interp=0x804f040, ns=0xb6471dbc, globalname=0xb634e500, val=0x82c31e4) at src/global.c:363
#4  0xb7d97a26 in Parrot_NameSpace_set_pmc_keyed (interp=0x804f040, pmc=0xb6471dbc, key=0x0, value=0x82c31e4)
    at ./src/pmc/namespace.pmc:349
#5  0xb7ae83f8 in Parrot_set_p_kc_p (cur_opcode=0xb6530330, interp=0x804f040) at src/ops/set.ops:427
#6  0xb7b7a4cc in runops_slow_core (interp=0x804f040, pc=0xb6530330) at src/runops_cores.c:222
#7  0xb7b4b019 in runops_int (interp=0x804f040, offset=3325) at src/interpreter.c:938
#8  0xb7b4b8f3 in runops (interp=0x804f040, offs=3325) at src/inter_run.c:103
#9  0xb7b4bbb1 in runops_args (interp=0x804f040, sub=0xb63f5058, obj=0x80b6f98, meth_unused=0x0, sig=0xb7e47f60 "vP",
    ap=0xbfb9142c "lK??lK??4.?x\024??\202>??@?\004\b\002") at src/inter_run.c:240
#10 0xb7b4bcec in Parrot_runops_fromc_args (interp=0x804f040, sub=0xb63f5058, sig=0xb7e47f60 "vP") at src/inter_run.c:305
#11 0xb7b34037 in Parrot_ex_throw_from_c (interp=0x804f040, exception=0xb63f4b6c) at src/exceptions.c:310
#12 0xb7b340fd in Parrot_ex_throw_from_c_args (interp=0x804f040, ret_addr=0x0, exitcode=20,
    format=0xb7e4b14c "Class %Ss already registered!\n") at src/exceptions.c:377
#13 0xb7b6df3a in fail_if_type_exists (interp=0x804f040, name=0xb63f4bdc) at src/oo.c:533
#14 0xb7b6dfa4 in Parrot_oo_register_type (interp=0x804f040, name=0xb63f4bdc) at src/oo.c:564
#15 0xb7d643f9 in init_class_from_hash (interp=0x804f040, self=0xb63f4e98, info=0xb63f4d10) at ./src/pmc/class.pmc:222
#16 0xb7d65e86 in Parrot_Class_init_pmc (interp=0x804f040, pmc=0xb63f4e98, init_data=0x81e4a8c) at ./src/pmc/class.pmc:512
#17 0xb7b79941 in pmc_new_init (interp=0x804f040, base_type=50, init=0x81e4a8c) at src/pmc.c:385
#18 0xb7ade958 in Parrot_newclass_p_p (cur_opcode=0xb60e8d70, interp=0x804f040) at src/ops/object.ops:254
#19 0xb7b7a4cc in runops_slow_core (interp=0x804f040, pc=0xb60e8d70) at src/runops_cores.c:222
#20 0xb7b4b019 in runops_int (interp=0x804f040, offset=3325) at src/interpreter.c:938
#21 0xb7b4b8f3 in runops (interp=0x804f040, offs=3325) at src/inter_run.c:103
#22 0xb7b4bbb1 in runops_args (interp=0x804f040, sub=0x81e2d3c, obj=0x80b6f98, meth_unused=0x0, sig=0xb7e47f60 "vP",
    ap=0xbfb9177c "?\031\036\b?\031\036\b4.??\027??\202>??@?\004\b\002") at src/inter_run.c:240
#23 0xb7b4bcec in Parrot_runops_fromc_args (interp=0x804f040, sub=0x81e2d3c, sig=0xb7e47f60 "vP") at src/inter_run.c:305
#24 0xb7b34037 in Parrot_ex_throw_from_c (interp=0x804f040, exception=0x81e19fc) at src/exceptions.c:310
#25 0xb7b340fd in Parrot_ex_throw_from_c_args (interp=0x804f040, ret_addr=0x0, exitcode=20,
    format=0xb7e4b14c "Class %Ss already registered!\n") at src/exceptions.c:377
#26 0xb7b6df3a in fail_if_type_exists (interp=0x804f040, name=0x81e1a88) at src/oo.c:533
#27 0xb7b6dfa4 in Parrot_oo_register_type (interp=0x804f040, name=0x81e1a88) at src/oo.c:564
#28 0xb7d643f9 in init_class_from_hash (interp=0x804f040, self=0x81e28f8, info=0x81e26e4) at ./src/pmc/class.pmc:222
#29 0xb7d65e86 in Parrot_Class_init_pmc (interp=0x804f040, pmc=0x81e28f8, init_data=0x81e4a8c) at ./src/pmc/class.pmc:512
#30 0xb7b79941 in pmc_new_init (interp=0x804f040, base_type=50, init=0x81e4a8c) at src/pmc.c:385
#31 0xb7ade958 in Parrot_newclass_p_p (cur_opcode=0xb60e8d70, interp=0x804f040) at src/ops/object.ops:254
#32 0xb7b7a4cc in runops_slow_core (interp=0x804f040, pc=0xb60e8d70) at src/runops_cores.c:222
#33 0xb7b4b019 in runops_int (interp=0x804f040, offset=3) at src/interpreter.c:938
#34 0xb7b4b8f3 in runops (interp=0x804f040, offs=3) at src/inter_run.c:103
#35 0xb7b4bbb1 in runops_args (interp=0x804f040, sub=0x80ef9f8, obj=0x80b6f98, meth_unused=0x0, sig=0xb7e47c1f "vP",
    ap=0xbfb91acc "??\016\b\b\033???\022??x?\023\b??\016\b??\016\b4.?\b\033??\030%?@?\004\b\002") at src/inter_run.c:240
#36 0xb7b4bcec in Parrot_runops_fromc_args (interp=0x804f040, sub=0x80ef9f8, sig=0xb7e47c1f "vP") at src/inter_run.c:305
#37 0xb7b31597 in Parrot_runcode (interp=0x804f040, argc=2, argv=0xbfb91c38) at src/embed.c:959
#38 0xb7e22518 in imcc_run_pbc (interp=0x804f040, obj_file=0, output_file=0x0, argc=2, argv=0xbfb91c38)
    at compilers/imcc/main.c:790
#39 0xb7e22fe5 in imcc_run (interp=0x804f040, sourcefile=0xbfb929c9 "tcl.pbc", argc=2, argv=0xbfb91c38)
    at compilers/imcc/main.c:1078
#40 0x080489a8 in main (argc=2, argv=0xbfb91c38) at src/main.c:61

Attachments

chromatic.patch Download (6.5 KB) - added by coke 6 years ago.
Patch suggested by chromatic…

Change History

Changed 6 years ago by coke

on OS X/intel, I get a Bus Error (at least in r33419; haven't done the binary search on this platform, assuming it's the same root cause.)

It's GC related (goes away with -G on both platforms.)

Here's the bt on OS X:

The program being debugged has been started already.
Start it from the beginning? (y or n) Starting program: /Users/coke/research/parrot/parrot tcl.pbc library/tcltest/tcltest.tcl
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000460
0x0100b521 in string_equal (interp=0x2506bd0, s1=0x44c, s2=0x2805304) at src/string.c:1437
1437        else if (s1->strlen != s2->strlen) {
#0  0x0100b521 in string_equal (interp=0x2506bd0, s1=0x44c, s2=0x2805304) at src/string.c:1437
#1  0x01267250 in ns_insert_sub_keyed_str (interp=0x2506bd0, self=0x3151804, key=0x359fea8, value=0x36daca8) at ./src/pmc/namespace.pmc:92
#2  0x01267c84 in Parrot_NameSpace_set_pmc_keyed_str (interp=0x2506bd0, pmc=0x3151804, key=0x359fea8, value=0x36daca8) at ./src/pmc/namespace.pmc:246
#3  0x0108dc0f in Parrot_set_global (interp=0x2506bd0, ns=0x3151804, globalname=0x359fea8, val=0x36daca8) at src/global.c:363
#4  0x01267aa0 in Parrot_NameSpace_set_pmc_keyed (interp=0x2506bd0, pmc=0x3151804, key=0x0, value=0x36daca8) at ./src/pmc/namespace.pmc:348
#5  0x010358ad in Parrot_set_p_kc_p (cur_opcode=0x2614678, interp=0x2506bd0) at src/ops/set.ops:427
#6  0x010da506 in runops_slow_core (interp=0x2506bd0, pc=0x2614678) at src/runops_cores.c:222
#7  0x01098dde in runops_int (interp=0x2506bd0, offset=9488) at src/interpreter.c:938
#8  0x01099773 in runops (interp=0x2506bd0, offs=9488) at src/inter_run.c:103
#9  0x01099a43 in runops_args (interp=0x2506bd0, sub=0x30a7ec4, obj=0x283c978, meth_unused=0x0, sig=0x1305b24 "vP", ap=0xbfffe2cc "$|\n\003ÐkP\002\002") at src/inter_run.c:240
#10 0x01099b78 in Parrot_runops_fromc_args (interp=0x2506bd0, sub=0x30a7ec4, sig=0x1305b24 "vP") at src/inter_run.c:305
#11 0x01081cba in Parrot_ex_throw_from_c (interp=0x2506bd0, exception=0x30a7c24) at src/exceptions.c:310
#12 0x01081d61 in Parrot_ex_throw_from_c_args (interp=0x2506bd0, ret_addr=0x0, exitcode=44, format=0x9015fb48 "No such file or directory") at src/exceptions.c:377
#13 0x0122729d in Parrot_OS_nci_stat (interp=0x2506bd0, pmc=0x698690) at ./src/pmc/os.pmc:235
#14 0x011c6b4f in Parrot_NCI_invoke (interp=0x2506bd0, pmc=0x698690, next=0x260e54c) at ./src/pmc/nci.pmc:321
#15 0x0102a020 in Parrot_callmethodcc_p_sc (cur_opcode=0x260e540, interp=0x2506bd0) at src/ops/object.ops:81
#16 0x010da506 in runops_slow_core (interp=0x2506bd0, pc=0x260e540) at src/runops_cores.c:222
#17 0x01098dde in runops_int (interp=0x2506bd0, offset=3325) at src/interpreter.c:938
#18 0x01099773 in runops (interp=0x2506bd0, offs=3325) at src/inter_run.c:103
#19 0x01099a43 in runops_args (interp=0x2506bd0, sub=0x312098c, obj=0x283c978, meth_unused=0x0, sig=0x1305b24 "vP", ap=0xbfffe62c "À\003\022\003ÐkP\002\002") at src/inter_run.c:240
#20 0x01099b78 in Parrot_runops_fromc_args (interp=0x2506bd0, sub=0x312098c, sig=0x1305b24 "vP") at src/inter_run.c:305
#21 0x01081cba in Parrot_ex_throw_from_c (interp=0x2506bd0, exception=0x31203c0) at src/exceptions.c:310
#22 0x01081d61 in Parrot_ex_throw_from_c_args (interp=0x2506bd0, ret_addr=0x0, exitcode=20, format=0x13187b8 "Class %Ss already registered!\n") at src/exceptions.c:377
#23 0x010ce0a8 in fail_if_type_exists (interp=0x2506bd0, name=0x31205b8) at src/oo.c:533
#24 0x010ce108 in Parrot_oo_register_type (interp=0x2506bd0, name=0x31205b8) at src/oo.c:564
#25 0x012353b7 in init_class_from_hash (interp=0x2506bd0, self=0x3120804, info=0x31206d0) at ./src/pmc/class.pmc:222
#26 0x01236e2a in Parrot_Class_init_pmc (interp=0x2506bd0, pmc=0x3120804, init_data=0x2748774) at ./src/pmc/class.pmc:512
#27 0x010d99ce in pmc_new_init (interp=0x2506bd0, base_type=50, init=0x2748774) at src/pmc.c:385
#28 0x0102b316 in Parrot_newclass_p_p (cur_opcode=0x24f9d70, interp=0x2506bd0) at src/ops/object.ops:254
#29 0x010da506 in runops_slow_core (interp=0x2506bd0, pc=0x24f9d70) at src/runops_cores.c:222
#30 0x01098dde in runops_int (interp=0x2506bd0, offset=3325) at src/interpreter.c:938
#31 0x01099773 in runops (interp=0x2506bd0, offs=3325) at src/inter_run.c:103
#32 0x01099a43 in runops_args (interp=0x2506bd0, sub=0x2745a2c, obj=0x283c978, meth_unused=0x0, sig=0x1305b24 "vP", ap=0xbfffe9dc "\030Qt\002ÐkP\002\002") at src/inter_run.c:240
#33 0x01099b78 in Parrot_runops_fromc_args (interp=0x2506bd0, sub=0x2745a2c, sig=0x1305b24 "vP") at src/inter_run.c:305
#34 0x01081cba in Parrot_ex_throw_from_c (interp=0x2506bd0, exception=0x2745118) at src/exceptions.c:310
#35 0x01081d61 in Parrot_ex_throw_from_c_args (interp=0x2506bd0, ret_addr=0x0, exitcode=20, format=0x13187b8 "Class %Ss already registered!\n") at src/exceptions.c:377
#36 0x010ce0a8 in fail_if_type_exists (interp=0x2506bd0, name=0x27451f8) at src/oo.c:533
#37 0x010ce108 in Parrot_oo_register_type (interp=0x2506bd0, name=0x27451f8) at src/oo.c:564
#38 0x012353b7 in init_class_from_hash (interp=0x2506bd0, self=0x2745604, info=0x27452d8) at ./src/pmc/class.pmc:222
#39 0x01236e2a in Parrot_Class_init_pmc (interp=0x2506bd0, pmc=0x2745604, init_data=0x2748774) at ./src/pmc/class.pmc:512
#40 0x010d99ce in pmc_new_init (interp=0x2506bd0, base_type=50, init=0x2748774) at src/pmc.c:385
#41 0x0102b316 in Parrot_newclass_p_p (cur_opcode=0x24f9d70, interp=0x2506bd0) at src/ops/object.ops:254
#42 0x010da506 in runops_slow_core (interp=0x2506bd0, pc=0x24f9d70) at src/runops_cores.c:222
#43 0x01098dde in runops_int (interp=0x2506bd0, offset=3) at src/interpreter.c:938
#44 0x01099773 in runops (interp=0x2506bd0, offs=3) at src/inter_run.c:103
#45 0x01099a43 in runops_args (interp=0x2506bd0, sub=0x6a4dc0, obj=0x283c978, meth_unused=0x0, sig=0x1305b24 "vP", ap=0xbfffed8c "tKj") at src/inter_run.c:240
#46 0x01099b78 in Parrot_runops_fromc_args (interp=0x2506bd0, sub=0x6a4dc0, sig=0x1305b24 "vP") at src/inter_run.c:305
#47 0x0107f2dc in Parrot_runcode (interp=0x2506bd0, argc=2, argv=0xbfffeed0) at src/embed.c:959
#48 0x012f0af2 in imcc_run_pbc (interp=0x2506bd0, obj_file=0, output_file=0x0, argc=2, argv=0xbfffeed0) at compilers/imcc/main.c:790
#49 0x012f1622 in imcc_run (interp=0x2506bd0, sourcefile=0xbfffefa7 "tcl.pbc", argc=2, argv=0xbfffeed0) at compilers/imcc/main.c:1078
#50 0x00002ca8 in main (argc=2, argv=0xbfffeed0) at src/main.c:61

Changed 6 years ago by coke

Recent changes to trunk no longer work with tcl's trunk; use tcl's parrot_io branch instead to get a version that works with parrot's svn-latest.

(Still segfaults, though.)

Changed 6 years ago by coke

  • milestone set to 0.8.2

Changed 6 years ago by coke

chromatic notes that the error (it's not a GC error, even though -G avoids it) goes away when the changes made to namespace.pmc in this commit are reversed.

Instead of poking directly into the Sub guts (not allowed if we want to be able to subclass .Sub, which Tcl does):

23:01 <@chromatic> Poking into its guts directly here with PMC_sub(pmc) is going to

give us the wrong answer.

23:03 <@chromatic> We should add some introspection magic into the Sub PMC and use

that instead.

That, or let's reverse this change before the 0.8.2 release.

Changed 6 years ago by coke

  • priority changed from unknown to major

Changed 6 years ago by coke

Patch suggested by chromatic...

Changed 6 years ago by coke

The patch suggested by chromatic here fails with a segfault when building PGE.

Changed 6 years ago by whiteknight

  • milestone changed from 0.8.2 to 0.9.0

Changed 5 years ago by coke

  • milestone 1.2 deleted

partcl can't even build right now.

Changed 5 years ago by coke

Partcl can build again.

$ parrot tcl.pbc library/tcltest/tcltest.tcl Object must be created by a class. Segmentation fault

So, can't track this down until we resolve TT #696

Changed 5 years ago by coke

  • status changed from new to closed
  • resolution set to fixed

This segfault no longer occurs.

Note: See TracTickets for help on using tickets.