In JavaScriptDistiller, inside of the createParser() function, we have: $parser->add( '/\/\*(.|[\r\n])*?\*\//' );
It took me hours to track down that this was causing Apache 2.1.11 to crash on nearly any page view on my test wiki. This happened when a large JS bundle is loaded, such as: load.php?debug=false&lang=en&modules=jquery.checkboxShiftClick|jquery.client|jquery.cookie|jquery.makeCollapsible|jquery.placeholder|mediawiki.action.watch.ajax|mediawiki.language|mediawiki.legacy.ajax|mediawiki.legacy.diff|mediawiki.legacy.mwsuggest|mediawiki.legacy.wikibits|mediawiki.util&skin=vector&version=20110129T005517Z
I made a simple php file to reproduce this. It crashes when viewed over apache but not CLI. It appears to be http://bugs.php.net/bug.php?id=47689 (which uses a similar regex).
Is something worth adding a note somewhere about or tweaking some code?
The default thread stack for Apache binary is 256Kb [1] However, apr_thread_create() allows to use a different stack size (apr_threadattr_stacksize_set). The value used is stored in the global variable ap_thread_stacksize which can be set in ThreadStackSize at httpd.conf http://httpd.apache.org/docs/2.2/mod/mpm_common.html#threadstacksize
Can you confirm that increasing it fixes your problem?
It surprises me that Pierre recommended tweaking the PE header instead of the config option.
[1] Here are the relevant fields for httpd-2.2.17-win32-x86-openssl-0.9.8o.msi 40000 size of stack reserve 1000 size of stack commit 100000 size of heap reserve 1000 size of heap commit
That's much better than using editbin :)
I added the following: <IfModule mpm_winnt_module> ThreadStackSize 8388608 </IfModule>
The stack overflow issue is gone now. This should be in the MW.org apache config docs and elsewhere (especially for 1.17, since nothing beforehand was running into this limit).
Platonides wrote:
The default thread stack for Apache binary is 256Kb [1] However, apr_thread_create() allows to use a different stack size (apr_threadattr_stacksize_set). The value used is stored in the global variable ap_thread_stacksize which can be set in ThreadStackSize at httpd.conf http://httpd.apache.org/docs/2.2/mod/mpm_common.html#threadstacksize
Can you confirm that increasing it fixes your problem?
It surprises me that Pierre recommended tweaking the PE header instead of the config option.
[1] Here are the relevant fields for httpd-2.2.17-win32-x86-openssl-0.9.8o.msi 40000 size of stack reserve 1000 size of stack commit 100000 size of heap reserve 1000 size of heap commit
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 01/29/2011 04:06 AM, Aaron Schulz wrote:
In JavaScriptDistiller, inside of the createParser() function, we have: $parser->add( '/\/\*(.|[\r\n])*?\*\//' );
It took me hours to track down that this was causing Apache 2.1.11 to crash on nearly any page view on my test wiki. This happened when a large JS bundle is loaded, such as: load.php?debug=false&lang=en&modules=jquery.checkboxShiftClick|jquery.client|jquery.cookie|jquery.makeCollapsible|jquery.placeholder|mediawiki.action.watch.ajax|mediawiki.language|mediawiki.legacy.ajax|mediawiki.legacy.diff|mediawiki.legacy.mwsuggest|mediawiki.legacy.wikibits|mediawiki.util&skin=vector&version=20110129T005517Z
I made a simple php file to reproduce this. It crashes when viewed over apache but not CLI. It appears to be http://bugs.php.net/bug.php?id=47689 (which uses a similar regex).
Is something worth adding a note somewhere about or tweaking some code?
Hmm... I don't really know what's going on inside PHP's PCRE implementation, but you might want to try replacing that regexp with:
$parser->add( '/\/\*.*?\*\//s' );
Ilmari Karonen wrote:
Hmm... I don't really know what's going on inside PHP's PCRE implementation, but you might want to try replacing that regexp with:
$parser->add( '/\/\*.*?\*\//s' );
The add()s are combined into a single big regex, you can't set dot-all. Doing it with (?s) may be factible, though.
On 01/30/2011 04:16 PM, Platonides wrote:
Ilmari Karonen wrote:
Hmm... I don't really know what's going on inside PHP's PCRE implementation, but you might want to try replacing that regexp with:
$parser->add( '/\\/\\*.*?\\*\\//s' );
The add()s are combined into a single big regex, you can't set dot-all. Doing it with (?s) may be factible, though.
Hmm, so maybe:
$parser->add( '/(?s:\/\*.*?\*\/)/' );
Or if that doesn't work, try something else that matches everything without parens, like [\s\S] or [\d\D].
Ilmari Karonen (2011-01-30 15:19):
On 01/30/2011 04:16 PM, Platonides wrote:
Ilmari Karonen wrote:
Hmm... I don't really know what's going on inside PHP's PCRE implementation, but you might want to try replacing that regexp with:
$parser->add( '/\\/\\*.*?\\*\\//s' );
The add()s are combined into a single big regex, you can't set dot-all. Doing it with (?s) may be factible, though.
Hmm, so maybe:
$parser->add( '/(?s:\\/\\*.*?\\*\\/)/' );
Or if that doesn't work, try something else that matches everything without parens, like [\s\S] or [\d\D].
Personally I like the [\s\S] construct, but maybe adding ?: in the parentheses would work:
$parser->add( '/\/\*(?:.|[\r\n])*?\*\//' );
Just guessing, but maybe the problem occurred because the script was trying to catch something in them...
Cheers, Nux.
wikitech-l@lists.wikimedia.org