I hacked the thread-id into deb.c/Perl_vdeb() so that perl -Dt also prints thread-id. The crashes seem to occur when one thread does a POPBLOCK/LEAVE as a sort finishes inside the for(). I further noticed that when I change:

for my $k (sort mycmp @list) {}

to simply:

sort mycmp @list;

the crashes go away. Edited perl -Dtlsv output follows:

4440: (p5-5A.pl:7) gvsv(main::a) 4440: (p5-5A.pl:7) length 4440: (p5-5A.pl:7) ncmp 4440: (p5-5A.pl:7) leavesub 4440: (p5-5A.pl:7) nextstate 4440: (p5-5A.pl:7) gvsv(main::b) 4440: (p5-5A.pl:7) length 4440: (p5-5A.pl:7) gvsv(main::a) 4440: (p5-5A.pl:7) length 9432: (p5-5A.pl:7) length 9432: (p5-5A.pl:7) ncmp 9432: (p5-5A.pl:7) leavesub 9432: (p5-5A.pl:7) nextstate 9432: (p5-5A.pl:7) gvsv(main::b) 9432: (p5-5A.pl:7) length 9432: (p5-5A.pl:7) gvsv(main::a) 9432: (p5-5A.pl:7) length 9432: (p5-5A.pl:7) ncmp 4440: (p5-5A.pl:7) ncmp 4440: (p5-5A.pl:7) leavesub 4440: (p5-5A.pl:7) nextstate 4440: (p5-5A.pl:7) gvsv(main::b) 4440: (p5-5A.pl:7) length 4440: (p5-5A.pl:7) gvsv(main::a) 4440: (p5-5A.pl:7) length 4440: (p5-5A.pl:7) ncmp *** tid=4440 crashed around here *** 9432: (p5-5A.pl:7) leavesub 9432: (p5-5A.pl:19) POPBLOCK scope 7 at ..\pp_sort.c:1579 9432: (p5-5A.pl:19) LEAVE scope 7 at ..\pp_sort.c:1627 9432: (p5-5A.pl:19) enteriter 9432: (p5-5A.pl:19) ENTER scope 7 at ..\pp_ctl.c:1666 9432: (p5-5A.pl:19) ENTER scope 8 at ..\pp_ctl.c:1697 9432: (p5-5A.pl:19) iter 9432: (p5-5A.pl:19) and (tid=9432 continues on)

In reply to Re: Perl threads sort test program crashes by eyepopslikeamosquito
in thread Perl threads sort test program crashes by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.