Closed jonathanstowe closed 2 years ago
Seems to be happening around calls to parsed-balanced(). This also demonstrates the issue:
use LibXML;
my LibXML $pparser .= new;
for 1 .. 1000 {
$*ERR.print: "[$_]";
$pparser.parse-balanced: :string("<x/>");
}
Example output on Rakudo™ v2021.10-108-gb994c6bbb.
$ valgrind `which raku` -I. /tmp/tst.raku
==6265== Memcheck, a memory error detector
==6265== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6265== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==6265== Command: /home/david/git/rakudo/install/bin/raku -I. /tmp/tst.raku
==6265==
[1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24][25][26][27][28][29][30][31][32][33][34][35][36][37][38][39][40][41][42][43][44][45][46][47][48][49][50][51][52][53][54][55][56][57][58][59][60][61][62][63][64][65][66][67][68][69][70][71][72][73][74][75][76][77][78][79][80][81][82][83][84][85][86][87][88][89][90][91][92][93][94][95][96][97][98][99][100][101][102][103][104][105][106][107][108][109][110][111][112][113][114][115][116][117][118][119][120][121][122][123][124][125][126][127][128][129][130][131][132][133][134][135][136][137][138][139][140][141][142][143][144][145][146][147][148][149][150][151][152][153][154][155][156][157][158][159][160][161][162][163][164][165]==6265== Invalid read of size 8
==6265== at 0x4AEFEC1: MVM_disp_program_run (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x4AE5CAE: dispatch_monomorphic (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x4A5DF40: MVM_interp_run (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x109604: main (in /home/david/git/rakudo.master/install/bin/rakudo)
==6265== Address 0x10 is not stack'd, malloc'd or (recently) free'd
==6265==
==6265==
==6265== Process terminating with default action of signal 11 (SIGSEGV)
==6265== Access not within mapped region at address 0x10
==6265== at 0x4AEFEC1: MVM_disp_program_run (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x4AE5CAE: dispatch_monomorphic (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x4A5DF40: MVM_interp_run (in /home/david/git/rakudo.master/install/lib/libmoar.so)
==6265== by 0x109604: main (in /home/david/git/rakudo.master/install/bin/rakudo)
==6265== If you believe this happened as a result of a stack
==6265== overflow in your program's main thread (unlikely but
==6265== possible), you can try to increase the size of the
==6265== main thread stack using the --main-stacksize= flag.
==6265== The main thread stack size used in this run was 8388608.
==6265==
==6265== HEAP SUMMARY:
==6265== in use at exit: 126,727,527 bytes in 462,440 blocks
==6265== total heap usage: 1,873,615 allocs, 1,411,175 frees, 1,028,153,375 bytes allocated
==6265==
==6265== LEAK SUMMARY:
==6265== definitely lost: 142,266 bytes in 2,694 blocks
==6265== indirectly lost: 444,458 bytes in 9,589 blocks
==6265== possibly lost: 8,215,088 bytes in 3,397 blocks
==6265== still reachable: 117,925,715 bytes in 446,760 blocks
==6265== suppressed: 0 bytes in 0 blocks
==6265== Rerun with --leak-check=full to see details of leaked memory
==6265==
==6265== For counts of detected and suppressed errors, rerun with: -v
==6265== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault
I think @jnthn has sussed it in https://github.com/jnthn/spreadsheet-xlsx/issues/14#issuecomment-972932699 - don't know how easy that is to fix.
Tests all passing on v2021.10-157-g26dd2f482..
The t/02parser.t gives:
Backtrace not particularly useful:
Running it with
rakudo-valgrind-m
seems to prevent the segfault.t/04node.t:
Same backtrace.
t/18docfree.t:
t/90threads.t:
This last in valgrind gives:
Which suggests that it might infact be something in moar.
The
libxml2
is2.9.12