xsl:sort with parameters not thread safe: double free or corruption (fasttop)
When load testing xsl:template designed to find the min (or max) of a set, my test program crashed (often) when running in parallel.
The issue is related to <xsl:sort order="ascending" data-type="{data-type}" case-order="{
case-order}" lang="{$lang}"/> .
No issues with <xsl:sort order="ascending" data-type="number" case-order="upper-first" lang="en"/> .
I have replaced the stylesheet in the test program testThreads.c . Please note that several runs my be required to reproduce.
Issue is reproducible on Linux as well as Windows.
Stack trace Linux:
#0 0x00007ffff561e37f in raise () from /lib64/libc.so.6
#1 0x00007ffff5608db5 in abort () from /lib64/libc.so.6
#2 0x00007ffff56614e7 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff56685ec in malloc_printerr () from /lib64/libc.so.6
#4 0x00007ffff566a034 in _int_free () from /lib64/libc.so.6
#5 0x00007ffff11a0d42 in xsltDefaultSortFunction () from /lib64/libxslt.so.1
#6 0x00007ffff11b9f80 in xsltForEach () from /lib64/libxslt.so.1
#7 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#8 0x00007ffff11bb222 in xsltApplyXSLTTemplate () from /lib64/libxslt.so.1
#9 0x00007ffff11bca22 in xsltCallTemplate () from /lib64/libxslt.so.1
#10 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#11 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#12 0x00007ffff11a855b in xsltEvalVariable () from /lib64/libxslt.so.1
#13 0x00007ffff11a8834 in xsltBuildVariable () from /lib64/libxslt.so.1
#14 0x00007ffff11a8926 in xsltRegisterVariable () from /lib64/libxslt.so.1
#15 0x00007ffff11b8af5 in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#16 0x00007ffff11b9c1c in xsltForEach () from /lib64/libxslt.so.1
#17 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#18 0x00007ffff11b9238 in xsltElement () from /lib64/libxslt.so.1
#19 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#20 0x00007ffff11bb222 in xsltApplyXSLTTemplate () from /lib64/libxslt.so.1
#21 0x00007ffff11bcb0a in xsltCallTemplate () from /lib64/libxslt.so.1
#22 0x00007ffff11b896c in xsltApplySequenceConstructor () from
/lib64/libxslt.so.1
#23 0x00007ffff11bb222 in xsltApplyXSLTTemplate () from /lib64/libxslt.so.1
#24 0x00007ffff11bbe3f in xsltProcessOneNode () from /lib64/libxslt.so.1
#25 0x00007ffff11be9a4 in xsltApplyStylesheetInternal () from
/lib64/libxslt.so.1
Test program incl. stylesheet: testThreads.c
Edited by Nick Wellnhofer