Hangup in converter mode with MusicXML source

• Aug 1, 2014 - 09:15
Type
Functional
Severity
S2 - Critical
Status
closed
Project

When running the current trunk in converter mode, with a MusicXML input file, MuseScore hangs at 100% CPU load. It seems this happens during schema validation. Output file type makes no difference, does not happen with MuseScore input files.

Examples:
./build.xcode/mscore/Debug/mscore.app/Contents/MacOS/mscore mtest/musicxml/io/testHello.xml -o ~/aaa.xml
-> hangs
./build.xcode/mscore/Debug/mscore.app/Contents/MacOS/mscore demos/Reunion.mscz -o ~/aaa.xml
-> works OK

Note that in normal mode (even when started as "./build.xcode/mscore/Debug/mscore.app/Contents/MacOS/mscore mtest/musicxml/io/testHello.xml", export to MusicXML works OK.

This has broken both the mtest/musicxml/io/iotest and the .../tst_mxml_io regression test.

Stack trace:
(gdb) bt
#0 0x00007fff9845fdd8 in pthread_once ()
#1 0x00007fff951831a0 in MachTimeConversionRate ()
#2 0x00007fff95183174 in GetCurrentEventTime ()
#3 0x00007fff9518a519 in ReceiveNextEventCommon ()
#4 0x00007fff9518a3fa in BlockUntilNextEventMatchingListInMode ()
#5 0x00007fff8e15d779 in _DPSNextEvent ()
#6 0x00007fff8e15d07d in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#7 0x0000000108ed96ea in QCocoaEventDispatcher::processEvents ()
#8 0x0000000101eeba33 in QEventLoop::exec ()
#9 0x0000000103516508 in QPatternist::AccelTreeResourceLoader::load ()
#10 0x00000001036e1865 in QPatternist::XsdSchemaParser::parseImport ()
#11 0x00000001036de777 in QPatternist::XsdSchemaParser::parseSchema ()
#12 0x00000001036da7ed in QPatternist::XsdSchemaParser::parse ()
#13 0x00000001035362ad in QXmlSchemaPrivate::load ()
#14 0x000000010353642d in QXmlSchemaPrivate::load ()
#15 0x0000000103534c6d in QXmlSchema::load ()
#16 0x00000001003e7cb2 in Ms::initMusicXmlSchema (schema=@0x7fff5fbfdd00) at /Users/lvi/dev/MuseScore/mscore/importxml.cpp:455
#17 0x00000001003e7084 in Ms::doValidate (name=@0x7fff5fbfe1f8, dev=0x7fff5fbfde58) at /Users/lvi/dev/MuseScore/mscore/importxml.cpp:563
#18 0x00000001003b4894 in Ms::doValidateAndImport (score=0x10b010000, name=@0x7fff5fbfe1f8, dev=0x7fff5fbfde58) at /Users/lvi/dev/MuseScore/mscore/importxml.cpp:627
#19 0x00000001003b481f in Ms::importMusicXml (score=0x10b010000, name=@0x7fff5fbfe1f8) at /Users/lvi/dev/MuseScore/mscore/importxml.cpp:671
#20 0x00000001001f15ef in Ms::readScore (score=0x10b010000, name=@0x7fff5fbfe1f8, ignoreVersionError=false) at /Users/lvi/dev/MuseScore/mscore/file.cpp:1853
#21 0x00000001001f0f53 in Ms::MuseScore::readScore (this=0x10fd3ab90, name=@0x1075578e8) at /Users/lvi/dev/MuseScore/mscore/file.cpp:318
#22 0x00000001004f2857 in Ms::loadScores (argv=@0x7fff5fbffa08) at /Users/lvi/dev/MuseScore/mscore/musescore.cpp:2159
#23 0x00000001004f1848 in main (argc=4, av=0x7fff5fbffad8) at /Users/lvi/dev/MuseScore/mscore/musescore.cpp:4924


Comments

It seems to happen only under Mac. I managed to reproduce in Mac OS X 10.8, but with a slightly different backtrace.
I think that the process is somehow waiting for something in the queue to be executed. I managed to solve the hang by adding qApp->processEvents(); just before schema.load(schemaBa); at line 455 of mscore/importxml.cpp.
See: https://github.com/AntonioBL/MuseScore/commit/fdd8b1e
Can you please try to see if this modification solves the bug also in your build?

The processEvents() should be probably added inside musescore.cpp, to prevent other possible hangs due to the same cause.

Antonio,

your fix works for me too. I have moved the additional processEvents() call to main() in score/musescore.cpp and submitted this as pull request #1150.

Regards, Leon.