Topic on Extension talk:SyntaxHighlight

Pygmentize process getting TimedOut

9
AhmadF.Cheema (talkcontribs)

Aside from the MediaWiki:Common.css page, any page (MediaWiki:Common.js, Module pages, pages including syntaxhighlight tags) that needs to call Extension:SyntaxHighlight throws out the following process timed out error:

Fatal exception of type "Symfony\Component\Process\Exception\ProcessTimedOutException"

The problematic process according to the logs:

The process "'.../extensions/SyntaxHighlight_GeSHi/pygments/pygmentize' '-l' 'lua' '-f' 'html' '-O' 'cssclass=mw-highlight,encoding=utf-8'" exceeded the timeout of 60 seconds.
  • Tested versions: MediaWiki core (REL1_30) - SyntaxHighlight_GeSHi (REL1_30) - PHP (5.6; 7.0; 7.1; 7.2)

In the case of REL1_31 branch, the process continues to run (and the browser continues to load) indefinitely without throwing out the timed out error. Even when the browser loading has been stopped, the php-cgi command keeps on running in the background and has to be manually terminated through SSH. This could possibly be because composer update removes the "symfony" package.

  • Tested versions: MediaWiki core (REL1_31) - SyntaxHighlight_GeSHi (REL1_31) - PHP (7.0; 7.1; 7.2)
  • Tested versions: MediaWiki core (REL1_31) - SyntaxHighlight_GeSHi (master) - PHP (7.2)

The pygmentize file has execute permissions (755). Also updated composer.

Platform is shared hosting CentOS environment. Process used to work previously, hosting support confirmed not to have made any changes to the server and even tried to run the script after disabling all firewall protections to no avail.

Anyone has any ideas?

Ciencia Al Poder (talkcontribs)

Does it happen on every CSS/JS page, or only some of them? Try to test with a simple CSS/JS page.

I had a similar problem with one specific page, which timed out, probably due to complex code or a bug in the syntax highlight code.

AhmadF.Cheema (talkcontribs)

Aside from MediaWiki:Common.css, on every page.

A confusing update.

  1. $wgMainCacheType (CACHE_MEMCACHED) turned Off - CSS/JS pages work fine.
  2. $wgMainCacheType turned On - CSS/JS pages continue to work fine.
  3. $wgMainCacheType again turned Off - CSS/JS pages start getting timed out.
    1. Comment out any extension - CSS/JS pages start working again.
    2. Re-enable the extension - CSS/JS pages continue to work fine.

Hard-refresh was done after every step. This situation was reproduce-able, however for the moment the issue with CSS/JS pages and any page containing syntaxhighlight tags code blocks appears to have stopped occurring.

However, during none of the steps above, do Module pages work. They continue to get timed out.

Update:

Module pages also appear to be working now, waiting for response from hosting provider regarding any changes on their end which might have fixed the issue.

Update II:

Hosting provider confirmed no changes on the server.

Apparently, will never get to the bottom of this.

Will close this issue in the next couple of days, unless any new information comes along.

Ciencia Al Poder (talkcontribs)

Maybe SyntaxHighlight is slow, and it eventually gets the syntax highlight correctly and caches it, so it works correctly next time you visit the page. Of course, this doesn't make sense when you turn off $wgMainCacheType and it still works fine. Maybe the page was cached on your browser and you didn't get to the server when you tried it...

AhmadF.Cheema (talkcontribs)

Possible, though seems doubtful, since I attempted this probably more than 10 times, with hard-refreshes and browser incognito windows.

Tystnaden (talkcontribs)

Do you have Python version 3 installed on the server? The version of Pygments used by the extension bundled with MW 1.31 requires python3 to be installed. I have added a note at the top of this article about this issue.

AhmadF.Cheema (talkcontribs)

I didn't before, but this particular weird issue was probably not linked to python3 as error came and went while using both MediaWiki v1.30 and 1.31 (and their corresponding extension versions). From what I understand python3 is needed when highlighting languages such as Lua, in the absence of python3, MediaWiki just outputs the non-highlighted version with a - Notice: Failed to invoke Pygments: /usr/bin/env: python3: No such file or directory - error in debugging mode.

Tystnaden (talkcontribs)

Okay, that does sound like a different problem.

Daimona Eaytoy (talkcontribs)
Reply to "Pygmentize process getting TimedOut"