Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault in MVMCallCapture.gc_mark #412

Closed
niner opened this issue Sep 23, 2016 · 2 comments
Closed

Segfault in MVMCallCapture.gc_mark #412

niner opened this issue Sep 23, 2016 · 2 comments

Comments

@niner
Copy link
Contributor

niner commented Sep 23, 2016

nine@sphinx:~/rakudo/nqp/MoarVM (master=)> perl6-gdb-m -e 'class SQLString { }; my $stringy = Str.^find_method("Stringy"); my $handler = $stringy.wrap(method () { SQLString.new(:str(callsame)) }); say "foo".Stringy'
================================================================================================
This Rakudo version is 2016.09.33.ge.12.ebb.9 built on MoarVM version 2016.09.1.gdebb.859,
running on opensuse (Tumbleweed) / linux (4.6.3.1.default)
------------------------------------------------------------------------------------------------
Reading symbols from /home/nine/rakudo/install/bin/moar...done.
Starting program: /home/nine/rakudo/install/bin/moar --execname=/home/nine/rakudo/install/bin/perl6-gdb-m --libpath=/home/nine/rakudo/install/share/nqp/lib --libpath=/home/nine/rakudo/install/share/perl6/lib --libpath=/home/nine/rakudo/install/share/perl6/runtime /home/nine/rakudo/install/share/perl6/runtime/perl6.moarvm -e class\ SQLString\ \{\ \}\;\ my\ \$stringy\ =\ Str.\^find_method\(\"Stringy\"\)\;\ my\ \$handler\ =\ \$stringy.wrap\(method\ \(\)\ \{\ SQLString.new\(:str\(callsame\)\)\ \}\)\;\ say\ \"foo\".Stringy
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff78fcb7f in gc_mark (tc=0x6037c0, st=0x606830, data=0x386a0d8, worklist=0x39f9cc0) at src/6model/reprs/MVMCallCapture.c:55
55                  if (flag_map[flag] & MVM_CALLSITE_ARG_NAMED) {
(gdb) l
50              MVMArgProcContext *ctx = body->apc;
51              MVMuint8  *flag_map = ctx->arg_flags ? ctx->arg_flags : ctx->callsite->arg_flags;
52              MVMuint16  count = ctx->arg_count;
53              MVMuint16  i, flag;
54              for (i = 0, flag = 0; i < count; i++, flag++) {
55                  if (flag_map[flag] & MVM_CALLSITE_ARG_NAMED) {
56                      /* Current position is name, then next is value. */
57                      MVM_gc_worklist_add(tc, worklist, &ctx->args[i].s);
58                      i++;
59                  }
(gdb) p flag_map
$1 = (MVMuint8 *) 0x3800000035 <error: Cannot access memory at address 0x3800000035>
(gdb) p ctx->arg_flags
$2 = (MVMCallsiteEntry *) 0x0
(gdb) p ctx->callsite->arg_flags
$3 = (MVMCallsiteEntry *) 0x3800000035 <error: Cannot access memory at address 0x3800000035>
(gdb) bt full
#0  0x00007ffff78fcb7f in gc_mark (tc=0x6037c0, st=0x606830, data=0x386a0d8, worklist=0x39f9cc0) at src/6model/reprs/MVMCallCapture.c:55
        ctx = 0x30bfd80
        count = 1
        i = 0
        flag = 0
        flag_map = 0x3800000035 <error: Cannot access memory at address 0x3800000035>
        body = 0x386a0d8
#1  0x00007ffff78c27b0 in MVM_gc_mark_collectable (tc=0x6037c0, worklist=0x39f9cc0, new_addr=0x386a0c0) at src/gc/collect.c:399
        new_addr_obj = 0x386a0c0
        i = 0
        sc_idx = 0
        __PRETTY_FUNCTION__ = "MVM_gc_mark_collectable"
#2  0x00007ffff78c1602 in process_worklist (tc=0x6037c0, worklist=0x39f9cc0, wtp=0x7fffffffbcd0, gen=0 '\000') at src/gc/collect.c:313
        item = 0x7ffff667dbb8
        item_gen2 = 0 '\000'
        to_gen2 = 1 '\001'
        gen2 = 0x603d00
        item_ptr = 0x34ec5b8
        new_addr = 0x386a0c0
        gen2count = 46
        __PRETTY_FUNCTION__ = "process_worklist"
#3  0x00007ffff78c1142 in MVM_gc_collect (tc=0x6037c0, what_to_do=0 '\000', gen=0 '\000') at src/gc/collect.c:129
        fromspace = 0x7ffff663b010
        tospace = 0x7ffff4d9c010
        worklist = 0x39f9cc0
        wtp = {num_target_threads = 0, target_work = 0x0}
#4  0x00007ffff78bc821 in run_gc (tc=0x6037c0, what_to_do=0 '\000') at src/gc/orchestrate.c:304
        other = 0x6037c0
        gen = 0 '\000'
        i = 0
        n = 1
#5  0x00007ffff78bcd05 in MVM_gc_enter_from_allocator (tc=0x6037c0) at src/gc/orchestrate.c:438
        last_starter = 0x622c80
        num_threads = 0
#6  0x00007ffff78bd0b7 in MVM_gc_allocate_nursery (tc=0x6037c0, size=280) at src/gc/allocation.c:32
        allocated = 0x7ffff6a3ae08
#7  0x00007ffff78bcfa5 in MVM_gc_allocate (tc=0x6037c0, size=280) at src/gc/allocation.h:13
No locals.
#8  0x00007ffff78bd133 in MVM_gc_allocate_zeroed (tc=0x6037c0, size=280) at src/gc/allocation.c:49
No locals.
#9  0x00007ffff78bd39e in MVM_gc_allocate_frame (tc=0x6037c0) at src/gc/allocation.c:99
        f = 0x6037c0
#10 0x00007ffff7892317 in MVM_frame_force_to_heap (tc=0x6037c0, frame=0x7ffff7fd45a8) at src/core/frame.c:657
        promoted = 0x7ffff6a3ae08
        cur_to_promote = 0x7ffff7fd4378
        new_cur_frame = 0x7ffff4df3460
        update_caller = 0x7ffff4df3578
        result = 0x7ffff4df3460
#11 0x00007ffff5e76b08 in p6finddispatcher (tc=0x6037c0, cur_op=0x30ab7e4 "") at src/vm/moar/ops/perl6_ops.c:543
        ctx = 0x2291390
#12 0x00007ffff788a574 in MVM_interp_run (tc=0x6037c0, initial_invoke=0x7ffff797de79 <toplevel_initial_invoke>, invoke_data=0x6738b8) at src/core/interp.c:5599
        op_before = 0x30ab7e4 ""
        record = 0xf18118
        op = 1029
        LABELS = {0x7ffff7860023 <MVM_interp_run+214>, 0x7ffff786005f <MVM_interp_run+274>, 0x7ffff7860061 <MVM_interp_run+276>, 0x7ffff7860061 <MVM_interp_run+276>, 0x7ffff786007c <MVM_interp_run+303>, 
          0x7ffff78600ff <MVM_interp_run+434>, 0x7ffff786011a <MVM_interp_run+461>, 0x7ffff78601a2 <MVM_interp_run+597>, 0x7ffff7860237 <MVM_interp_run+746>, 0x7ffff78602c7 <MVM_interp_run+890>, 
          0x7ffff786035a <MVM_interp_run+1037>, 0x7ffff78603ed <MVM_interp_run+1184>, 0x7ffff786047e <MVM_interp_run+1329>, 0x7ffff7860512 <MVM_interp_run+1477>, 0x7ffff78605a6 <MVM_interp_run+1625>, 
          0x7ffff7860637 <MVM_interp_run+1770>, 0x7ffff78606c6 <MVM_interp_run+1913>, 0x7ffff7860756 <MVM_interp_run+2057>, 0x7ffff78607e5 <MVM_interp_run+2200>, 0x7ffff7860874 <MVM_interp_run+2343>, 
          0x7ffff7860904 <MVM_interp_run+2487>, 0x7ffff7860993 <MVM_interp_run+2630>, 0x7ffff7860a29 <MVM_interp_run+2780>, 0x7ffff7860abf <MVM_interp_run+2930>, 0x7ffff7860b38 <MVM_interp_run+3051>, 
          0x7ffff7860bec <MVM_interp_run+3231>, 0x7ffff7860ca0 <MVM_interp_run+3411>, 0x7ffff7860d64 <MVM_interp_run+3607>, 0x7ffff7860e28 <MVM_interp_run+3803>, 0x7ffff7860f05 <MVM_interp_run+4024>, 
          0x7ffff7860fe2 <MVM_interp_run+4245>, 0x7ffff78610b6 <MVM_interp_run+4457>, 0x7ffff786118a <MVM_interp_run+4669>, 0x7ffff7861249 <MVM_interp_run+4860>, 0x7ffff7861308 <MVM_interp_run+5051>, 
          0x7ffff7861431 <MVM_interp_run+5348>, 0x7ffff78615fa <MVM_interp_run+5805>, 0x7ffff78617ef <MVM_interp_run+6306>, 0x7ffff78618a1 <MVM_interp_run+6484>, 0x7ffff7861955 <MVM_interp_run+6664>, 
          0x7ffff7861a07 <MVM_interp_run+6842>, 0x7ffff7861ae7 <MVM_interp_run+7066>, 0x7ffff7861b93 <MVM_interp_run+7238>, 0x7ffff7861c3f <MVM_interp_run+7410>, 0x7ffff7861ceb <MVM_interp_run+7582>, 
          0x7ffff7861d97 <MVM_interp_run+7754>, 0x7ffff7861d97 <MVM_interp_run+7754>, 0x7ffff7861db2 <MVM_interp_run+7781>, 0x7ffff7861e64 <MVM_interp_run+7959>, 0x7ffff7861f12 <MVM_interp_run+8133>, 
          0x7ffff786272f <MVM_interp_run+10210>, 0x7ffff7862861 <MVM_interp_run+10516>, 0x7ffff78628ec <MVM_interp_run+10655>, 0x7ffff7862983 <MVM_interp_run+10806>, 0x7ffff7862a0e <MVM_interp_run+10945>, 
          0x7ffff7862a99 <MVM_interp_run+11084>, 0x7ffff7862b03 <MVM_interp_run+11190>, 0x7ffff7862bbe <MVM_interp_run+11377>, 0x7ffff7862c79 <MVM_interp_run+11564>, 0x7ffff7862d34 <MVM_interp_run+11751>, 
          0x7ffff7862def <MVM_interp_run+11938>, 0x7ffff7862eaa <MVM_interp_run+12125>, 0x7ffff7862f65 <MVM_interp_run+12312>, 0x7ffff7863053 <MVM_interp_run+12550>, 0x7ffff7863108 <MVM_interp_run+12731>, 
          0x7ffff78631c0 <MVM_interp_run+12915>, 0x7ffff7863276 <MVM_interp_run+13097>, 0x7ffff78633f8 <MVM_interp_run+13483>, 0x7ffff78634b3 <MVM_interp_run+13670>, 0x7ffff78635ac <MVM_interp_run+13919>, 
          0x7ffff786366a <MVM_interp_run+14109>, 0x7ffff78636fd <MVM_interp_run+14256>, 0x7ffff78637be <MVM_interp_run+14449>, 0x7ffff7863833 <MVM_interp_run+14566>, 0x7ffff78638a8 <MVM_interp_run+14683>, 
          0x7ffff786391d <MVM_interp_run+14800>, 0x7ffff7863992 <MVM_interp_run+14917>, 0x7ffff7863a47 <MVM_interp_run+15098>, 0x7ffff7863afc <MVM_interp_run+15279>, 0x7ffff7863bb1 <MVM_interp_run+15460>, 
          0x7ffff7863c44 <MVM_interp_run+15607>, 0x7ffff7863cf9 <MVM_interp_run+15788>, 0x7ffff7863dae <MVM_interp_run+15969>, 0x7ffff7863ec5 <MVM_interp_run+16248>, 0x7ffff7863f5e <MVM_interp_run+16401>, 
          0x7ffff7864086 <MVM_interp_run+16697>, 0x7ffff78641c8 <MVM_interp_run+17019>, 0x7ffff7864292 <MVM_interp_run+17221>, 0x7ffff786435c <MVM_interp_run+17423>, 0x7ffff786441a <MVM_interp_run+17613>, 
          0x7ffff78644d8 <MVM_interp_run+17803>, 0x7ffff7864596 <MVM_interp_run+17993>, 0x7ffff7864654 <MVM_interp_run+18183>, 0x7ffff786474a <MVM_interp_run+18429>, 0x7ffff7864803 <MVM_interp_run+18614>, 
          0x7ffff78648bc <MVM_interp_run+18799>, 0x7ffff7864975 <MVM_interp_run+18984>, 0x7ffff7864a2e <MVM_interp_run+19169>, 0x7ffff7864b47 <MVM_interp_run+19450>, 0x7ffff7864be5 <MVM_interp_run+19608>, 
          0x7ffff7864cb1 <MVM_interp_run+19812>, 0x7ffff7864d82 <MVM_interp_run+20021>, 0x7ffff7864e2c <MVM_interp_run+20191>, 0x7ffff7864ed6 <MVM_interp_run+20361>, 0x7ffff7864f80 <MVM_interp_run+20531>, 
          0x7ffff786502a <MVM_interp_run+20701>, 0x7ffff78650d4 <MVM_interp_run+20871>, 0x7ffff786517e <MVM_interp_run+21041>, 0x7ffff7865228 <MVM_interp_run+21211>, 0x7ffff78652d2 <MVM_interp_run+21381>, 
          0x7ffff78653a3 <MVM_interp_run+21590>, 0x7ffff7865459 <MVM_interp_run+21772>, 0x7ffff7865501 <MVM_interp_run+21940>, 0x7ffff78655ab <MVM_interp_run+22110>, 0x7ffff7865655 <MVM_interp_run+22280>, 
          0x7ffff78656ff <MVM_interp_run+22450>, 0x7ffff78657b5 <MVM_interp_run+22632>, 0x7ffff786585f <MVM_interp_run+22802>, 0x7ffff7865909 <MVM_interp_run+22972>, 0x7ffff78659b3 <MVM_interp_run+23142>, 
          0x7ffff7865a4d <MVM_interp_run+23296>, 0x7ffff7865ae3 <MVM_interp_run+23446>, 0x7ffff7865b86 <MVM_interp_run+23609>, 0x7ffff7865c35 <MVM_interp_run+23784>, 0x7ffff7865cd8 <MVM_interp_run+23947>, 
          0x7ffff7865d80 <MVM_interp_run+24115>, 0x7ffff7865e3b <MVM_interp_run+24302>, 0x7ffff7865ef6 <MVM_interp_run+24489>, 0x7ffff7865f85 <MVM_interp_run+24632>, 0x7ffff786601d <MVM_interp_run+24784>, 
          0x7ffff78660b7 <MVM_interp_run+24938>, 0x7ffff786614f <MVM_interp_run+25090>, 0x7ffff78661e7 <MVM_interp_run+25242>, 0x7ffff7866272 <MVM_interp_run+25381>, 0x7ffff7866302 <MVM_interp_run+25525>, 
          0x7ffff786639f <MVM_interp_run+25682>, 0x7ffff78664c6 <MVM_interp_run+25977>, 0x7ffff7866608 <MVM_interp_run+26299>, 0x7ffff786674a <MVM_interp_run+26621>, 0x7ffff786688c <MVM_interp_run+26943>, 
          0x7ffff78669ce <MVM_interp_run+27265>, 0x7ffff7866a5a <MVM_interp_run+27405>, 0x7ffff7866afd <MVM_interp_run+27568>, 0x7ffff7866bb0 <MVM_interp_run+27747>, 0x7ffff7866c53 <MVM_interp_run+27910>, 
          0x7ffff7866cf6 <MVM_interp_run+28073>, 0x7ffff7866dda <MVM_interp_run+28301>, 0x7ffff7866ec0 <MVM_interp_run+28531>, 0x7ffff7866fa4 <MVM_interp_run+28759>, 0x7ffff7867088 <MVM_interp_run+28987>, 
          0x7ffff7867143 <MVM_interp_run+29174>, 0x7ffff786720e <MVM_interp_run+29377>, 0x7ffff78672c9 <MVM_interp_run+29564>, 0x7ffff7867384 <MVM_interp_run+29751>, 0x7ffff7867480 <MVM_interp_run+30003>, 
          0x7ffff786757e <MVM_interp_run+30257>, 0x7ffff786767a <MVM_interp_run+30509>, 0x7ffff7867776 <MVM_interp_run+30761>, 0x7ffff7867817 <MVM_interp_run+30922>, 0x7ffff78678a7 <MVM_interp_run+31066>, 
          0x7ffff786793b <MVM_interp_run+31214>, 0x7ffff7867a45 <MVM_interp_run+31480>, 0x7ffff7867ac5 <MVM_interp_run+31608>, 0x7ffff7867b68 <MVM_interp_run+31771>, 0x7ffff7867c0c <MVM_interp_run+31935>, 
          0x7ffff7867d2f <MVM_interp_run+32226>, 0x7ffff7867e52 <MVM_interp_run+32517>, 0x7ffff7867f43 <MVM_interp_run+32758>, 0x7ffff7868033 <MVM_interp_run+32998>, 0x7ffff7868177 <MVM_interp_run+33322>, 
          0x7ffff7868268 <MVM_interp_run+33563>, 0x7ffff7868325 <MVM_interp_run+33752>, 0x7ffff78683e2 <MVM_interp_run+33941>, 0x7ffff786849f <MVM_interp_run+34130>, 0x7ffff786854c <MVM_interp_run+34303>, 
          0x7ffff78685f9 <MVM_interp_run+34476>, 0x7ffff78686a6 <MVM_interp_run+34649>, 0x7ffff7868761 <MVM_interp_run+34836>, 0x7ffff78687d6 <MVM_interp_run+34953>, 0x7ffff7868844 <MVM_interp_run+35063>, 
          0x7ffff78688fc <MVM_interp_run+35247>, 0x7ffff7868989 <MVM_interp_run+35388>, 0x7ffff7868a79 <MVM_interp_run+35628>, 0x7ffff7868b1c <MVM_interp_run+35791>, 0x7ffff7868ba8 <MVM_interp_run+35931>, 
          0x7ffff7868c34 <MVM_interp_run+36071>, 0x7ffff7868d3e <MVM_interp_run+36337>, 0x7ffff7868e7a <MVM_interp_run+36653>, 0x7ffff7868fb6 <MVM_interp_run+36969>, 0x7ffff7869102 <MVM_interp_run+37301>, 
          0x7ffff786923e <MVM_interp_run+37617>, 0x7ffff786947f <MVM_interp_run+38194>, 0x7ffff78695b7 <MVM_interp_run+38506>, 0x7ffff78696d6 <MVM_interp_run+38793>, 0x7ffff7869891 <MVM_interp_run+39236>, 
          0x7ffff7869975 <MVM_interp_run+39464>, 0x7ffff7869a3a <MVM_interp_run+39661>, 0x7ffff7869aac <MVM_interp_run+39775>, 0x7ffff7869b45 <MVM_interp_run+39928>, 0x7ffff7869c0a <MVM_interp_run+40125>...}
        cur_op = 0x30ab7e4 ""
        bytecode_start = 0x30ab790 <incomplete sequence \367>
        reg_base = 0x39d1370
        cu = 0x663280
        cur_callsite = 0x7ffff7dd8b20 <null_args_callsite>
#13 0x00007ffff797df9c in MVM_vm_run_file (instance=0x603010, filename=0x7fffffffdc84 "/home/nine/rakudo/install/share/perl6/runtime/perl6.moarvm") at src/moar.c:304
        tc = 0x6037c0
        cu = 0x661e80
#14 0x000000000040128f in main (argc=8, argv=0x7fffffffd638) at src/main.c:191
        instance = 0x603010
        input_file = 0x7fffffffdc84 "/home/nine/rakudo/install/share/perl6/runtime/perl6.moarvm"
        executable_name = 0x7fffffffdbbc "/home/nine/rakudo/install/bin/perl6-gdb-m"
        lib_path = {0x7fffffffdbf0 "/home/nine/rakudo/install/share/nqp/lib", 0x7fffffffdc22 "/home/nine/rakudo/install/share/perl6/lib", 0x7fffffffdc56 "/home/nine/rakudo/install/share/perl6/runtime", 0x0, 
          0xc2 <error: Cannot access memory at address 0xc2>, 0x7fffffffd52f "", 0x7fffffffd52e "", 
          0x7ffff74032f5 <handle_intel+101> "H\205\300uyL\211\351L\211\342D\211\376\211\357\350\266\374\377\377H\205\300ud\213t$\bL\211\351L\211\342\211\357\350\240\374\377\377H\205\300uND9t$\fA\215V\001v0A\211ָ\002"}
        dump = 0
        full_cleanup = 0
        argi = 6
        lib_path_i = 3
        flag = -2
@LLFourn
Copy link

LLFourn commented Sep 28, 2016

note: This is related to https://rt.perl.org/Public/Bug/Display.html?id=128553

@niner I'm so glad you were able to golf this. I had a huge project that was suffering from it and I couldn't figure out what was causing the segfaults. Removed the .wrap and it works again (so far).

@jnthn
Copy link
Member

jnthn commented Jul 13, 2017

Was almost certainly the same issues as #612 which has now finally been hunted down and fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants