Last modified: 2014-11-19 19:57:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T75073, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 73073 - GraphViz and MscGen Graphics produce errors and do not render properly when page saved
GraphViz and MscGen Graphics produce errors and do not render properly when p...
Status: PATCH_TO_REVIEW
Product: MediaWiki extensions
Classification: Unclassified
Other (Other open bugs)
REL1_23-branch
Other Linux
: Unprioritized major (vote)
: ---
Assigned To: Keith Welter
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-06 09:27 UTC by praeponiertesNichts
Modified: 2014-11-19 19:57 UTC (History)
1 user (show)

See Also:
Web browser: Firefox
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Log file of MediaWiki with GraphViz extension (947.32 KB, application/octet-stream)
2014-11-13 08:51 UTC, praeponiertesNichts
Details

Description praeponiertesNichts 2014-11-06 09:27:34 UTC
Intention:
Creating a graphic with the GraphViz extension. Visualization.

Steps to Reproduce:
1. c/p graphviz graph into mediawiki site
<mscgen caption='Message sequence chart for example no. 4'>
msc {
  a,b,c;

  a->b  [label="ab()"];
  b->c  [label="bc(TRUE)"];
  c=>c  [label="process(1)"];
  c=>c  [label="process(2)"];
  ...;
  c=>c  [label="process(n)"];
  c=>c  [label="process(END)"];
  a<<=c [label="callback()"];
  ---   [label="If more to run", ID="*"];
  a->a  [label="next()"];
  a->c  [label="ac()"];
  b<-c  [label="cb(TRUE)"];
  b->b  [label="stalled(...)"];
  a<-b  [label="ab() = FALSE"];
}
</mscgen>
2. then save the page
3. 

Actual Results:  
[b0268cc7] /w/rurakprod/index.php?title=TestSeite4&action=submit Exception from line 77 of /var/www/w/rurakprod/includes/parser/StripState.php: Invalid marker: UNIQce56658f4d73e6e7-mscgen-00000000-QINU

Backtrace:

#0 /var/www/w/rurakprod/includes/parser/StripState.php(66): StripState->addItem(string, string, string)
#1 /var/www/w/rurakprod/includes/parser/Parser.php(4062): StripState->addGeneral(string, string)
#2 /var/www/w/rurakprod/includes/parser/Preprocessor_DOM.php(1178): Parser->extensionSubstitution(array, PPFrame_DOM)
#3 /var/www/w/rurakprod/includes/parser/Parser.php(3153): PPFrame_DOM->expand(PPNode_DOM, integer)
#4 /var/www/w/rurakprod/includes/parser/Parser.php(4640): Parser->replaceVariables(string)
#5 /var/www/w/rurakprod/includes/parser/Parser.php(4597): Parser->pstPass2(string, User)
#6 [internal function]: Parser->preSaveTransform(string, Title, User, ParserOptions)
#7 /var/www/w/rurakprod/includes/StubObject.php(99): call_user_func_array(array, array)
#8 /var/www/w/rurakprod/includes/StubObject.php(119): StubObject->_call(string, array)
#9 /var/www/w/rurakprod/includes/content/WikitextContent.php(145): StubObject->__call(string, array)
#10 /var/www/w/rurakprod/includes/content/WikitextContent.php(145): StubObject->preSaveTransform(string, Title, User, ParserOptions)
#11 /var/www/w/rurakprod/includes/WikiPage.php(2087): WikitextContent->preSaveTransform(Title, User, ParserOptions)
#12 /var/www/w/rurakprod/includes/WikiPage.php(1761): WikiPage->prepareContentForEdit(WikitextContent, NULL, User, string)
#13 [internal function]: WikiPage->doEditContent(WikitextContent, string, integer, boolean, NULL, string)
#14 /var/www/w/rurakprod/includes/Article.php(2024): call_user_func_array(array, array)
#15 /var/www/w/rurakprod/includes/EditPage.php(1812): Article->__call(string, array)
#16 /var/www/w/rurakprod/includes/EditPage.php(1812): Article->doEditContent(WikitextContent, string, integer, boolean, NULL, string)
#17 /var/www/w/rurakprod/includes/EditPage.php(1237): EditPage->internalAttemptSave(array, boolean)
#18 /var/www/w/rurakprod/includes/EditPage.php(427): EditPage->attemptSave()
#19 /var/www/w/rurakprod/includes/actions/EditAction.php(50): EditPage->edit()
#20 /var/www/w/rurakprod/includes/actions/EditAction.php(74): EditAction->show()
#21 /var/www/w/rurakprod/includes/Wiki.php(428): SubmitAction->show()
#22 /var/www/w/rurakprod/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
#23 /var/www/w/rurakprod/includes/Wiki.php(588): MediaWiki->performRequest()
#24 /var/www/w/rurakprod/includes/Wiki.php(447): MediaWiki->main()
#25 /var/www/w/rurakprod/index.php(46): MediaWiki->run()
#26 {main}



Reproducible: Always
Comment 1 praeponiertesNichts 2014-11-06 09:35:42 UTC
<graphviz caption='Graph for example no. 3 (contains Wiki-Links)' alt='phylogenetic tree' format='png'>
digraph example3 {
  node [shape=plaintext];
  Mollusca [URL="[[w:Mollusca]]"];
  Neomeniomorpha [URL="[[w:Neomeniomorpha]]"];
  X1 [shape=point,label=""];
  Caudofoveata [URL="[[w:Caudofoveata]]"];
  Testaria [URL="[[w:Testaria]]"];
  Polyplacophora [URL="[[w:Polyplacophora]]"];
  Conchifera [URL="[[w:Conchifera]]"];
  Tryblidiida [URL="[[w:Tryblidiida]]"];
  Ganglioneura [URL="[[w:Ganglioneura]]"];
  Bivalvia [URL="[[w:Bivalvia]]"];
  X2 [shape=point,label=""];
  X3 [shape=point,label=""];
  Scaphopoda [URL="[[w:Scaphopoda]]"];
  Cephalopoda [URL="[[w:Cephalopoda]]"];
  Gastropoda [URL="[[w:Gastropoda]]"];
  Mollusca->X1->Testaria->Conchifera->Ganglioneura->X2->Gastropoda
  Mollusca->Neomeniomorpha
  X1->Caudofoveata
  Testaria->Polyplacophora
  Conchifera->Tryblidiida
  Ganglioneura ->Bivalvia
  X2->X3->Cephalopoda
  X3->Scaphopoda
}
</graphviz>

produces:

[3b7b305e] /w/rurakprod/index.php?title=TestSeite4&action=submit Exception from line 77 of /var/www/w/rurakprod/includes/parser/StripState.php: Invalid marker: UNIQ3b979957875f41aa-graphviz-00000000-QINU

Backtrace:

#0 /var/www/w/rurakprod/includes/parser/StripState.php(66): StripState->addItem(string, string, string)
#1 /var/www/w/rurakprod/includes/parser/Parser.php(4062): StripState->addGeneral(string, string)
#2 /var/www/w/rurakprod/includes/parser/Preprocessor_DOM.php(1178): Parser->extensionSubstitution(array, PPFrame_DOM)
#3 /var/www/w/rurakprod/includes/parser/Parser.php(3153): PPFrame_DOM->expand(PPNode_DOM, integer)
#4 /var/www/w/rurakprod/includes/parser/Parser.php(4640): Parser->replaceVariables(string)
#5 /var/www/w/rurakprod/includes/parser/Parser.php(4597): Parser->pstPass2(string, User)
#6 [internal function]: Parser->preSaveTransform(string, Title, User, ParserOptions)
#7 /var/www/w/rurakprod/includes/StubObject.php(99): call_user_func_array(array, array)
#8 /var/www/w/rurakprod/includes/StubObject.php(119): StubObject->_call(string, array)
#9 /var/www/w/rurakprod/includes/content/WikitextContent.php(145): StubObject->__call(string, array)
#10 /var/www/w/rurakprod/includes/content/WikitextContent.php(145): StubObject->preSaveTransform(string, Title, User, ParserOptions)
#11 /var/www/w/rurakprod/includes/WikiPage.php(2087): WikitextContent->preSaveTransform(Title, User, ParserOptions)
#12 /var/www/w/rurakprod/includes/WikiPage.php(1761): WikiPage->prepareContentForEdit(WikitextContent, NULL, User, string)
#13 [internal function]: WikiPage->doEditContent(WikitextContent, string, integer, boolean, NULL, string)
#14 /var/www/w/rurakprod/includes/Article.php(2024): call_user_func_array(array, array)
#15 /var/www/w/rurakprod/includes/EditPage.php(1812): Article->__call(string, array)
#16 /var/www/w/rurakprod/includes/EditPage.php(1812): Article->doEditContent(WikitextContent, string, integer, boolean, NULL, string)
#17 /var/www/w/rurakprod/includes/EditPage.php(1237): EditPage->internalAttemptSave(array, boolean)
#18 /var/www/w/rurakprod/includes/EditPage.php(427): EditPage->attemptSave()
#19 /var/www/w/rurakprod/includes/actions/EditAction.php(50): EditPage->edit()
#20 /var/www/w/rurakprod/includes/actions/EditAction.php(74): EditAction->show()
#21 /var/www/w/rurakprod/includes/Wiki.php(428): SubmitAction->show()
#22 /var/www/w/rurakprod/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
#23 /var/www/w/rurakprod/includes/Wiki.php(588): MediaWiki->performRequest()
#24 /var/www/w/rurakprod/includes/Wiki.php(447): MediaWiki->main()
#25 /var/www/w/rurakprod/index.php(46): MediaWiki->run()
#26 {main}
Comment 2 Keith Welter 2014-11-07 03:29:28 UTC
Hi, I have not been able to reproduce this problem.  My platform is:
GraphViz 1.5.0
MW 1.23.6
Ubuntu 14.04 
PHP 5.5.9-1ubuntu4.4
MySQL 5.5.40-0ubuntu0.14.04.1

Please provide a debug log as described here:
https://www.mediawiki.org/wiki/Manual:How_to_debug#Setting_up_a_debug_log_file

Thanks!
Comment 3 praeponiertesNichts 2014-11-07 08:50:18 UTC
My working environment
MW 1.23.6
Debian GNU/Linux 7.7 (wheezy)
PHP Version => 5.4.34-0+deb7u1
mysql  Ver 14.14 Distrib 5.5.40, for debian-linux-gnu (x86_64) using readline 6.2
Comment 4 Keith Welter 2014-11-08 03:25:06 UTC
Hi, here are the steps I did to setup a debug log on my system:
sudo mkdir /var/log/mediawiki
sudo chown www-data /var/log/mediawiki
gedit ~/public_html/mediawiki/w23_6/LocalSettings.php
  $wgDebugLogFile = "/var/log/mediawiki/debug-wiki23_6.log";

After you've confirmed that logging is working, it is nice to delete the log prior to recreating the problem so that it doesn't contain extraneous info.  After the recreate, it is also nice to copy the log to a separate file so to be attached here.

Let me know if you have trouble obtaining a debug log of the problem on your system.

Thanks,
Keith
Comment 5 praeponiertesNichts 2014-11-13 08:51:14 UTC
Created attachment 17111 [details]
Log file of MediaWiki with GraphViz extension

I attempted to use create the four examples from the GraphViz extension page.
Comment 6 Keith Welter 2014-11-13 17:55:44 UTC
In the log I noticed that Semantic MediaWiki was installed.  I installed it on my system and I am now able to recreate the problem.
Comment 7 Keith Welter 2014-11-14 04:54:05 UTC
The StripState.php: Invalid marker exception is caused by a recursive call to Parser::parse.  The documentation for Parser::parse says, "Do not call this function recursively." 

Here is a bit of code I added at the beginning of Parser::parse to detect recursion:
$callers = array_slice( debug_backtrace(), 1 );
foreach( $callers as $caller ) {
  if ( $caller['function'] == __FUNCTION__ && isset( $caller['class'] ) && $caller['class'] == __CLASS__ ) {
    throw new MWException( __METHOD__ . ": detected recursion");
  }
}

This yields a stack trace showing how the illegal recursion came about:

[fda8b10b] /wiki/Main_Page Exception from line 366 of /home/welterkj/public_html/mediawiki/w23/includes/parser/Parser.php: Parser::parse: detected recursion

Backtrace:

#0 /home/welterkj/public_html/mediawiki/w23/includes/content/WikitextContent.php(322): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#1 /home/welterkj/public_html/mediawiki/w23/includes/WikiPage.php(2091): WikitextContent->getParserOutput(Title, NULL, ParserOptions)
#2 /home/welterkj/public_html/mediawiki/w23/extensions/SemanticMediaWiki/includes/src/MediaWiki/EditInfoProvider.php(88): WikiPage->prepareContentForEdit(WikitextContent, NULL, User, string)
#3 /home/welterkj/public_html/mediawiki/w23/extensions/SemanticMediaWiki/includes/src/MediaWiki/EditInfoProvider.php(66): SMW\MediaWiki\EditInfoProvider->prepareContentForEdit()
#4 /home/welterkj/public_html/mediawiki/w23/extensions/SemanticMediaWiki/includes/src/MediaWiki/Hooks/NewRevisionFromEditComplete.php(81): SMW\MediaWiki\EditInfoProvider->fetchEditInfo()
#5 /home/welterkj/public_html/mediawiki/w23/extensions/SemanticMediaWiki/includes/src/MediaWiki/Hooks/NewRevisionFromEditComplete.php(76): SMW\MediaWiki\Hooks\NewRevisionFromEditComplete->getParserOutputFromEditInfo()
#6 /home/welterkj/public_html/mediawiki/w23/extensions/SemanticMediaWiki/includes/Setup.php(392): SMW\MediaWiki\Hooks\NewRevisionFromEditComplete->process()
#7 [internal function]: SMW\Setup->SMW\{closure}(WikiFilePage, Revision, integer, User)
#8 /home/welterkj/public_html/mediawiki/w23/includes/Hooks.php(206): call_user_func_array(Closure, array)
#9 /home/welterkj/public_html/mediawiki/w23/includes/GlobalFunctions.php(4004): Hooks::run(string, array, NULL)
#10 /home/welterkj/public_html/mediawiki/w23/includes/filerepo/file/LocalFile.php(1393): wfRunHooks(string, array)
#11 /home/welterkj/public_html/mediawiki/w23/includes/filerepo/file/LocalFile.php(1174): LocalFile->recordUpload2(string, string, string, array, boolean, User)
#12 /home/welterkj/public_html/mediawiki/w23/includes/upload/UploadBase.php(694): LocalFile->upload(string, string, string, integer, NULL, boolean, User)
#13 /home/welterkj/public_html/mediawiki/w23/extensions/GraphViz/UploadLocalFile.php(238): UploadBase->performUpload(string, string, boolean, User)
#14 /home/welterkj/public_html/mediawiki/w23/extensions/GraphViz/GraphViz_body.php(1156): UploadLocalFile::upload(string, string, User, string, string, boolean, boolean)
#15 /home/welterkj/public_html/mediawiki/w23/extensions/GraphViz/GraphViz_body.php(756): GraphViz::render(string, array, Parser, PPFrame_DOM)
#16 [internal function]: GraphViz::graphvizParserHook(string, array, Parser, PPFrame_DOM)
#17 /home/welterkj/public_html/mediawiki/w23/includes/parser/Parser.php(4028): call_user_func_array(array, array)
#18 /home/welterkj/public_html/mediawiki/w23/includes/parser/Preprocessor_DOM.php(1178): Parser->extensionSubstitution(array, PPFrame_DOM)
#19 /home/welterkj/public_html/mediawiki/w23/includes/parser/Parser.php(3162): PPFrame_DOM->expand(PPNode_DOM, integer)
#20 /home/welterkj/public_html/mediawiki/w23/includes/parser/Parser.php(1225): Parser->replaceVariables(string)
#21 /home/welterkj/public_html/mediawiki/w23/includes/parser/Parser.php(404): Parser->internalParse(string)
#22 /home/welterkj/public_html/mediawiki/w23/includes/content/WikitextContent.php(322): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#23 /home/welterkj/public_html/mediawiki/w23/includes/WikiPage.php(3614): WikitextContent->getParserOutput(Title, integer, ParserOptions)
#24 /home/welterkj/public_html/mediawiki/w23/includes/poolcounter/PoolCounterWork.php(112): PoolWorkArticleView->doWork()
#25 /home/welterkj/public_html/mediawiki/w23/includes/Article.php(710): PoolCounterWork->execute()
#26 /home/welterkj/public_html/mediawiki/w23/includes/actions/ViewAction.php(44): Article->view()
#27 /home/welterkj/public_html/mediawiki/w23/includes/Wiki.php(428): ViewAction->show()
#28 /home/welterkj/public_html/mediawiki/w23/includes/Wiki.php(292): MediaWiki->performAction(Article, Title)
#29 /home/welterkj/public_html/mediawiki/w23/includes/Wiki.php(588): MediaWiki->performRequest()
#30 /home/welterkj/public_html/mediawiki/w23/includes/Wiki.php(447): MediaWiki->main()
#31 /home/welterkj/public_html/mediawiki/w23/index.php(46): MediaWiki->run()
#32 {main}
Comment 8 Keith Welter 2014-11-14 05:04:59 UTC
The key points from the prior back trace are:
1) The GraphViz extension uploaded a file (a graph image) from the context of a Parser::parse call.
2) The upload triggered the NewRevisionFromEditComplete hook.
3) The Semantic MediaWiki extension NewRevisionFromEditComplete hook eventually called Parser::parse (indirectly) which causes the reported Invalid Marker exception.
Comment 9 Gerrit Notification Bot 2014-11-19 19:57:55 UTC
Change 174487 had a related patch set uploaded by Welterkj:
Prevent recursive call to Parser::parse (see bug 73073).

https://gerrit.wikimedia.org/r/174487

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links