Mediawiki SphinxSearch extensions kills Apache

328 views Asked by At

I`m trying to make knowleage base for my company based on Mediawiki.

I have installed and configured Mediawiki 1.21.2 at my own VDS (debian, apache 2.2.16. php 5.3.3.7). I used Sphinx search engine and SphinxSearch Mediawiki extension.

But now I try to do the same at production virtual server (CentOS, apache 2.2.15+nginx 1.0.15, php 5.3.3 and Mediawiki 1.21.3) and got some problems with search:

When i make a search request that should definitily return some value nginx shows 502 Bad Gateway error. If there is no information to return, an usual MediaWiki message is shown.

In apache log I see following:

[Wed Dec 04 14:06:27 2013] [notice] child pid 12603 exit signal Segmentation fault (11)

In site`s error log there is only some warnings about StrictStandart:

[Wed Dec 04 11:30:09 2013] [error] [client 127.0.0.1] PHP Strict Standards:  Declaration of SphinxMWSearch::userHighlightPrefs() should be compatible with that of SearchEngine::userHighlightPrefs() in /var/www/vhosts/itkgwiki/extensions/SphinxSearch/SphinxMWSearch.php on line 15, referer: http://my-site/pagename
[Wed Dec 04 11:30:10 2013] [error] [client 127.0.0.1] PHP Strict Standards:  Declaration of SphinxMWSearch::userHighlightPrefs() should be compatible with that of SearchEngine::userHighlightPrefs() in /var/www/vhosts/itkgwiki/extensions/SphinxSearch/SphinxMWSearch.php on line 329, referer: http://my-site/pagename

Then go to mediawiki log file:

Start request GET /index.php?search=test&fulltext=%D0%9D%D0%B0%D0%B9%D1%82%D0%B8&title=%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F%3A%D0%9F%D0%BE%D0%B8%D1%81%D0%BA
HTTP HEADERS:
HOST: itkg-wiki-new
X-REAL-IP: 192.68.0.136
X-FORWARDED-FOR: 192.68.0.136
CONNECTION: close
ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
USER-AGENT: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36
REFERER: http://itkg-wiki-new/w/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0
ACCEPT-ENCODING: gzip,deflate,sdch
ACCEPT-LANGUAGE: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
COOKIE: show-.7B.7B.7B2.7D.7D.7D=collapsed; show-MM=expanded; show-HR-PV=expanded; show-FM=expanded; show-PM=expanded; show-IM=expanded; show-PS=expanded; show-RE=expanded; show-ADV=expanded; show-HR_PB=expanded; show-AA=expanded; show-ZBSL=expanded; show-HRM=expanded; show-REP=expanded; show-FOT=expanded; show-PFR=expanded; show-TAB=expanded; show-KAD=expanded; show-FI=expanded; show-NAV=expanded; show-PP=expanded; show-SL=collapsed; show-SHR=collapsed; show-CO=collapsed; wikiEditor-0-booklet-characters-page=latin; wikiEditor-0-booklet-help-page=format; vector-nav-p-tb=true; jwplayer.volume=100; jwplayer.mute=false; show-FI=expanded; show-NAV=expanded; show-SL=expanded; itkgwikiUserID=2; itkgwikiUserName=Oleg; itkgwiki_session=55dd7644b240946c896c4db9c54f8e73; wikiEditor-0-toolbar-section=advanced
CACHES: EmptyBagOStuff[main] SqlBagOStuff[message] SqlBagOStuff[parser]
[cookie] session_set_cookie_params: "0", "/", "", "", "1"
LocalisationCache: using store LCStore_DB
Unstubbing $wgParser on call of $wgParser::setFunctionHook from SimpleSecurity::setup
Parser: using preprocessor: Preprocessor_DOM
Connecting to localhost itkgwiki...
Implicit transaction open enabled.
Profiler::instance called without $wgProfiler['class'] set, falling back to ProfilerStub for safety
Connected to localhost itkgwiki.
Connected to database 0 at localhost
Implicit transaction start.
Fully initialised
User: cache miss for user 2
User: loading options for user 2 from database.
User: logged in from session
User: loading options for user 2 from override cache.
Connecting to localhost itkgwiki...
Implicit transaction open enabled.
Connected to localhost itkgwiki.
Connected to database 0 at localhost
Implicit transactions are now disabled.
Connection Resource id #124 will be used for SqlBagOStuff
MessageCache::load: Loading ru... got from global cache
Unstubbing $wgLang on call of $wgLang::_unstub from ParserOptions::__construct
SphinxSearch query: test
Use of wfMsg was deprecated in MediaWiki 1.21. [Called from SphinxMWSearchResultSet::getInfo in /var/www/vhosts/itkgwiki/extensions/SphinxSearch/SphinxMWSearch.php at line 545]
Use of wfMsgReal was deprecated in MediaWiki 1.21. [Called from wfMsg in /var/www/vhosts/itkgwiki/includes/GlobalFunctions.php at line 1444]
Use of wfMsgGetKey was deprecated in MediaWiki 1.21. [Called from wfMsgReal in /var/www/vhosts/itkgwiki/includes/GlobalFunctions.php at line 1542]
[ContentHandler] Created handler for wikitext: WikitextContentHandler

Let`s strace apache:

30093 15:33:08.748226 lstat("/var/www/vhosts/itkgwiki/includes/content/WikitextContentHandler.php", {st_mode=S_IFREG|0644, st_size=2516, ...}) = 0 
30093 15:33:08.748280 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.748332 open("/var/www/vhosts/itkgwiki/includes/content/WikitextContentHandler.php", O_RDONLY) = 16                  30093 15:33:08.748403 fstat(16, {st_mode=S_IFREG|0644, st_size=2516, ...}) = 0 
30093  15:33:08.748469 fstat(16, {st_mode=S_IFREG|0644, st_size=2516, ...}) = 0 
30093 15:33:08.748547 fstat(16, {st_mode=S_IFREG|0644, st_size=2516, ...}) = 0 
30093 15:33:08.748607 mmap(NULL, 2516, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc4000 
30093 15:33:08.748756 munmap(0x7f4866fc4000, 2516) = 0 
30093 15:33:08.748800 close(16)         = 0 
30093 15:33:08.748851 lstat("/var/www/vhosts/itkgwiki/includes/content/TextContentHandler.php", {st_mode=S_IFREG|0644, st_size=3236, ...}) = 0 
30093 15:33:08.748904 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.748956 open("/var/www/vhosts/itkgwiki/includes/content/TextContentHandler.php", O_RDONLY) = 16 30093 15:33:08.749035 fstat(16, {st_mode=S_IFREG|0644, st_size=3236, ...}) = 0 
30093 15:33:08.749101 fstat(16, {st_mode=S_IFREG|0644, st_size=3236, ...}) = 0 
30093 15:33:08.749162 fstat(16, {st_mode=S_IFREG|0644, st_size=3236, ...}) = 0 
0093 15:33:08.749223 mmap(NULL, 3236, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc4000 
30093 15:33:08.749434 munmap(0x7f4866fc4000, 3236) = 0 
30093 15:33:08.749492 close(16)         = 0 
30093 15:33:08.749606 lstat("/var/www/vhosts/itkgwiki/includes/content/WikitextContent.php", {st_mode=S_IFREG|0644, st_size=9098, ...}) = 0 
30093 15:33:08.749661 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.749713 open("/var/www/vhosts/itkgwiki/includes/content/WikitextContent.php", O_RDONLY) = 16 
30093 15:33:08.749785 fstat(16, {st_mode=S_IFREG|0644, st_size=9098, ...}) = 0 
30093 15:33:08.749850 fstat(16, {st_mode=S_IFREG|0644, st_size=9098, ...}) = 0 
30093 15:33:08.749911 fstat(16, {st_mode=S_IFREG|0644, st_size=9098, ...}) = 0 
30093 15:33:08.749972 mmap(NULL, 9098, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc2000 
30093 15:33:08.750399 brk(0x7f486a134000) = 0x7f486a134000 
30093 15:33:08.750546 munmap(0x7f4866fc2000, 9098) = 0 
30093 15:33:08.750596 close(16)         = 0 
30093 15:33:08.750644 lstat("/var/www/vhosts/itkgwiki/includes/content/TextContent.php", {st_mode=S_IFREG|0644, st_size=8039, ...}) = 0 
30093 15:33:08.750696 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.750748 open("/var/www/vhosts/itkgwiki/includes/content/TextContent.php", O_RDONLY) = 16 30093 15:33:08.750818 fstat(16, {st_mode=S_IFREG|0644, st_size=8039, ...}) = 0 
30093 15:33:08.750884 fstat(16, {st_mode=S_IFREG|0644, st_size=8039, ...}) = 0 
30093 15:33:08.750945 fstat(16, {st_mode=S_IFREG|0644, st_size=8039, ...}) = 0 
30093 15:33:08.751005 mmap(NULL, 8039, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc3000 
30093 15:33:08.751380 munmap(0x7f4866fc3000, 8039) = 0 
30093 15:33:08.751429 close(16)         = 0 
30093 15:33:08.751491 lstat("/var/www/vhosts/itkgwiki/includes/content/AbstractContent.php", {st_mode=S_IFREG|0644, st_size=10154, ...}) = 0 
30093 15:33:08.751544 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.751597 open("/var/www/vhosts/itkgwiki/includes/content/AbstractContent.php", O_RDONLY) = 16 
30093 15:33:08.751640 fstat(16, {st_mode=S_IFREG|0644, st_size=10154, ...}) = 0 
30093 15:33:08.751708 fstat(16, {st_mode=S_IFREG|0644, st_size=10154, ...}) = 0 
30093 15:33:08.751769 fstat(16, {st_mode=S_IFREG|0644, st_size=10154, ...}) = 0 
30093 15:33:08.751830 mmap(NULL, 10154, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc2000 30093 15:33:08.752214 munmap(0x7f4866fc2000, 10154) = 0 
30093 15:33:08.752261 close(16)         = 0 
30093 15:33:08.752315 lstat("/var/www/vhosts/itkgwiki/includes/content/Content.php", {st_mode=S_IFREG|0644, st_size=16546, ...}) = 0 
30093 15:33:08.752366 lstat("/var/www/vhosts/itkgwiki/includes/content", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 
30093 15:33:08.752418 open("/var/www/vhosts/itkgwiki/includes/content/Content.php", O_RDONLY) = 16 
30093 15:33:08.752462 fstat(16, {st_mode=S_IFREG|0644, st_size=16546, ...}) = 0 
30093 15:33:08.752544 fstat(16, {st_mode=S_IFREG|0644, st_size=16546, ...}) = 0 
30093 15:33:08.752611 fstat(16, {st_mode=S_IFREG|0644, st_size=16546, ...}) = 0 
30093 15:33:08.752671 mmap(NULL, 16546, PROT_READ, MAP_SHARED, 16, 0) = 0x7f4866fc0000 30093 15:33:08.752945 munmap(0x7f4866fc0000, 16546) = 0 
30093 15:33:08.752994 close(16)         = 0 
30093 15:33:08.753141 --- SIGSEGV (Segmentation fault) @ 0 (0) --- 
30093 15:33:08.753259 chdir("/etc/httpd") = 0 30093 15:33:08.753303 rt_sigaction(SIGSEGV, {SIG_DFL, [], SA_RESTORER|SA_INTERRUPT, 0x7f486592f500}, {SIG_DFL, [], SA_RESTORER|SA_RESETHAND, 0x7f486592f500}, 8) = 0 
30093 15:33:08.753359 kill(30093, SIGSEGV) = 0 
30093 15:33:08.753395 rt_sigreturn(0x758d) = 0 
30093 15:33:08.753431 --- SIGSEGV (Segmentation fault) @ 0 (0) ---

My skills are too poor for making desision from this, so I would be very happy to have any advice.

1

There are 1 answers

1
Ilmari Karonen On

Basically, the problem seems to be that, back in MediaWiki 1.18, the SearchEngine::userHighlightPrefs() method was changed to no longer take a User object as a parameter. Unfortunately, this change caused any existing subclasses overriding that method to break under PHP strict mode.

Frankly, I think that was a poor decision: classes that are meant to be subclassed by third-party code should not have their method signatures changed willy-nilly without a very good reason. That said, it happened over two years ago, so it might be a bit late now to ask that it be reverted. Probably the best thing to do would be to deprecate the whole mess and fix all extensions not to use it; in fact, this should've been done long ago, but apparently the SphinxSearch extension has, coincidentally, been suffering from a lack of maintenance attention lately.

Anyway, there are several ways you could fix this for yourself:

  • The fix I'd recommend is upgrading SphinxSearch to the latest version, from which the problematic method override has recently been removed. I'm not quite sure if that fixes the problem entirely, though, since it seems that the method is still called from parts of the code with the extra User parameter. But if it doesn't, then that's a bug in the extension and should be reported.

  • You could also modify the SphinxSearch code yourself, removing the custom userHighlightPrefs() method and any calls to it. If you do get it working this way (after upgrading to the latest version first), you may want to submit your changes as a patch.

  • Finally, as suggested in this discussion on mediawiki.org, you could simply turn off strict mode in php.ini, e.g. by setting:

    error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT