Yep, tidy is not very tidy. It's been a good source of crashes for as long as 
I've been aware of it.

Anyone running MarkLogic on OSX might like to know how to simulate pstack on 
OSX with a simple script. This requires gdb, of course. The output can be very 
useful for reporting bugs, and sometimes for diagnostics. Just save it as 
/usr/bin/pstack and make it executable.

#!/usr/bin/env bash
#
# Fake pstack on OSX
# http://stackoverflow.com/a/12394981/908390
#
######################################################################

set -e

tmp=$(mktemp -t pstack)
echo thread apply all bt >"$tmp"
gdb -batch -nx -nw -q -x "${tmp}" -p "$1"
rm -f "$tmp"

# end pstack

For this test case it looks like the crash is in strcmp, called by 
parseStartTag.

Thread 80 (process 73728):
#0  0x00007fff90131e22 in __wait4 ()
#1  0x00000001023f65dc in xdmp::pstack ()
#2  0x00000001023f70b6 in pstackSignalAction ()
#3  <signal handler called>
#4  0x00007fff8d453d13 in _platform_strcmp ()
#5  0x0000000101e80408 in xdmp::XMLParser::parseStartTag ()
#6  0x0000000101e7be7a in xdmp::XMLParser::parse ()
#7  0x0000000101e7c137 in xdmp::parseXML ()
#8  0x000000010272a644 in xdmp::doTidy ()
#9  0x000000010272eaa0 in xdmp::xdmp_tidy ()

-- Mike

On 4 Jun 2014, at 15:40 , Jakob Fix <[email protected]> wrote:

> try for yourself (7.0-2.3 on Mac):
> 
> let $u := 
> "http://www.larepublica.co/ocde-recomienda-fortalecer-el-sistema-de-planeaci%C3%B3n_124391";
> 
> let $c := xdmp:http-get($u,
> <options xmlns="xdmp:http" xmlns:d="xdmp:document-get">
> <verify-cert>false</verify-cert>
> <d:encoding>UTF-8</d:encoding>
> <d:repair>full</d:repair>
> </options>
> )
> 
> let $d := xdmp:tidy($c[2],
> <options xmlns="xdmp:tidy">
> <new-blocklevel-tags>section, header, time, figure, nav, 
> article</new-blocklevel-tags>
> <bare>yes</bare>
> <clean>yes</clean>
> <hide-comments>yes</hide-comments>
> </options>
> )[2]
> 
> return $d
> 
> 
> log set to "finest" returns just this:
> 
> Segmentation fault in thread 7411003392 addr 0x2aef14847
> /usr/bin/pstack: No such file or directory
> 2014-06-05 00:33:07.647 Notice: Starting MarkLogic Server 7.0-2.3 x86_64 in 
> /Users/jakob/Library/MarkLogic with data in /Users/jakob/Library/Application 
> Support/MarkLogic/Data
> 2014-06-05 00:33:07.655 Info: Host jfix.local running Darwin 13.2.0
> 
> of course (and most fortunately) this requires some weirdness in the document 
> passed to xdmp:tidy, but still a pain if you can't control the input you're 
> getting...
> 
> cheers,
> Jakob.
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to