最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - MediaWiki timeout, apparent memory loop - Stack Overflow

programmeradmin1浏览0评论

I'm getting the following when accessing pages in certain namespaces in a previously working site:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /usr/local/var/www/mediawiki-1.43.0/includes/libs/rdbms/database/DatabaseMySQL.php on line 670

Background

I loaded a bunch of info into MediaWiki 1.43.0 (latest as of today) in late Februray, and have not touched it since February 28, when I gave a demo in which all features were working.

Things I've done prior to then included setting up numerous namespaces and categories. They all worked as of February 28.

Now, when I try to access certain namespaces (Template, Category, Minutes, Policy, Request, Agreement), it hangs up as noted above.

It was originally failing with a different message, a 30-second timeout. After searching for a solution, it was suggested that putting the following at the top of php.ini would help:

$cfg['ExecTimeLimit'] = 0;

I did that and re-started httpd. Then the timeout notice went away, replaced by the DatabaseMySQL.php error noted above.

Nothing shows up in the httpd error_log. I know I have the right one, because it noted the re-start after changing php.ini.

Nothing interesting shows up in the httpd access_log:

----------------
127.0.0.1 - - [13/Mar/2025:10:49:31 -0700] "GET /wiki/index.php/Special:RecentChanges HTTP/1.1" 200 227

(I put the row of dashes in the log to mark what is new.)

The MariaDB log shows a timeout, but I can access all the MediaWiki tables using a different interface (Sequel Pro, Querius, and the mysql CLI) instantaneously.

----------------
2025-03-13 10:58:49 131 [Warning] Aborted connection 131 to db: 'Hearthstone' user: 'root' host: 'localhost' (Got an error reading communication packets)

So it seems clear it is an apache/php/mediawiki problem, not a database one. It seems likely that something is causing a recursive memory-eating loop, causing the database connection to timeout.

So, what changed since February 28?

Well, I updated from MacOS 13.7.3 to 13.7.4, which was just a maintenance update. That seems like an unlikely cause, as MariaDB and apache seem to be otherwise working fine.

I had changed from a DHCP-assigned address to "DHCP with Manual Address" with the fixed address 192.168.10.254, because local users had trouble with the previous dynamic address. I also changed this back to a DHCP-assigned address (it gave me the old .106 address that I had before), and still had the problem.

I wanted the wiki to be in local time, instead of UTC. I un-commented this line in php.ini and re-started apache. I did not save any wiki pages while in this state, and have since changed it back to commented out, and re-started apache.

;date.timezone = 'America/Vancouver'

I have been experimenting with extensions, but I have commented out all the wfLoadExtension('…'); lines in LocalSettings.php — even ones that had been working fine on February 28th.

I also commented out all the namespaces I added, even though they had not changed since February 28th. That did not change the behaviour, so I un-commented it.

$wgExtraNamespaces =
    array(  3000 => 'Test',
        3001 => 'Test_talk',
        3002 => 'Minutes',
        3003 => 'Minutes_talk',
        3004 => 'Policy',
        3005 => 'Policy_talk',
        3006 => 'Proposal',
        3007 => 'Proposal_talk',
        3006 => 'Request',
        3007 => 'Request_talk',
        3008 => 'Agreement',
        3009 => 'Agreement_talk',
        3010 => 'Project',
        3011 => 'Project_talk'
        );
$wgContentNamespaces = array(3002, 3004, 3006, 3008, 3010);

Finally, I went into the MediaWiki maintenance directory, and read at least the first page of each file there. I didn't see anything that seemed like it would address my issue.

I've been hacking MediaWiki since 1.12, but I'm at a bit of a loss here.

Often, in the course of providing a good description like this one, I figure out what's wrong. But not this time!

Any ideas on how to troubleshoot this?

Thanks!

I'm getting the following when accessing pages in certain namespaces in a previously working site:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /usr/local/var/www/mediawiki-1.43.0/includes/libs/rdbms/database/DatabaseMySQL.php on line 670

Background

I loaded a bunch of info into MediaWiki 1.43.0 (latest as of today) in late Februray, and have not touched it since February 28, when I gave a demo in which all features were working.

Things I've done prior to then included setting up numerous namespaces and categories. They all worked as of February 28.

Now, when I try to access certain namespaces (Template, Category, Minutes, Policy, Request, Agreement), it hangs up as noted above.

It was originally failing with a different message, a 30-second timeout. After searching for a solution, it was suggested that putting the following at the top of php.ini would help:

$cfg['ExecTimeLimit'] = 0;

I did that and re-started httpd. Then the timeout notice went away, replaced by the DatabaseMySQL.php error noted above.

Nothing shows up in the httpd error_log. I know I have the right one, because it noted the re-start after changing php.ini.

Nothing interesting shows up in the httpd access_log:

----------------
127.0.0.1 - - [13/Mar/2025:10:49:31 -0700] "GET /wiki/index.php/Special:RecentChanges HTTP/1.1" 200 227

(I put the row of dashes in the log to mark what is new.)

The MariaDB log shows a timeout, but I can access all the MediaWiki tables using a different interface (Sequel Pro, Querius, and the mysql CLI) instantaneously.

----------------
2025-03-13 10:58:49 131 [Warning] Aborted connection 131 to db: 'Hearthstone' user: 'root' host: 'localhost' (Got an error reading communication packets)

So it seems clear it is an apache/php/mediawiki problem, not a database one. It seems likely that something is causing a recursive memory-eating loop, causing the database connection to timeout.

So, what changed since February 28?

Well, I updated from MacOS 13.7.3 to 13.7.4, which was just a maintenance update. That seems like an unlikely cause, as MariaDB and apache seem to be otherwise working fine.

I had changed from a DHCP-assigned address to "DHCP with Manual Address" with the fixed address 192.168.10.254, because local users had trouble with the previous dynamic address. I also changed this back to a DHCP-assigned address (it gave me the old .106 address that I had before), and still had the problem.

I wanted the wiki to be in local time, instead of UTC. I un-commented this line in php.ini and re-started apache. I did not save any wiki pages while in this state, and have since changed it back to commented out, and re-started apache.

;date.timezone = 'America/Vancouver'

I have been experimenting with extensions, but I have commented out all the wfLoadExtension('…'); lines in LocalSettings.php — even ones that had been working fine on February 28th.

I also commented out all the namespaces I added, even though they had not changed since February 28th. That did not change the behaviour, so I un-commented it.

$wgExtraNamespaces =
    array(  3000 => 'Test',
        3001 => 'Test_talk',
        3002 => 'Minutes',
        3003 => 'Minutes_talk',
        3004 => 'Policy',
        3005 => 'Policy_talk',
        3006 => 'Proposal',
        3007 => 'Proposal_talk',
        3006 => 'Request',
        3007 => 'Request_talk',
        3008 => 'Agreement',
        3009 => 'Agreement_talk',
        3010 => 'Project',
        3011 => 'Project_talk'
        );
$wgContentNamespaces = array(3002, 3004, 3006, 3008, 3010);

Finally, I went into the MediaWiki maintenance directory, and read at least the first page of each file there. I didn't see anything that seemed like it would address my issue.

I've been hacking MediaWiki since 1.12, but I'm at a bit of a loss here.

Often, in the course of providing a good description like this one, I figure out what's wrong. But not this time!

Any ideas on how to troubleshoot this?

Thanks!

Share Improve this question edited Mar 13 at 22:49 Shadow 34.3k10 gold badges65 silver badges75 bronze badges asked Mar 13 at 21:56 Jan SteinmanJan Steinman 3433 silver badges14 bronze badges 1
  • 1 If it's a memory loop, you should have an out of memory error with a stack trace (assuming you have set up logging properly, which you should). That should give you an idea of what's using up the memory. – Tgr Commented Mar 14 at 16:00
Add a comment  | 

2 Answers 2

Reset to default 0

ARGH!

Yes, I did say I had disabled all extensions. I was wrong.

I had arranged them in alphabetical order, each followed by any additional code they may require.

So I started at the end, and methodically went up and commented out each extension… until I got to something that didn't look like an extension, and then I thought, "Job done!"

But it wasn't done. AccessControl had some required settings following it's loading command, that I thoughtlessly meant I was at the end of the extension loading:

wfLoadExtension( 'AccessControl' ); # https://www.mediawiki./wiki/Extension:AccessControl
$wgGroupPermissions['*']['read']            = true;
$wgGroupPermissions['*']['createaccount']   = false;
$wgGroupPermissions['*']['edit']            = false;
$wgGroupPermissions['*']['writeapi']        = false;
$wgGroupPermissions['*']['createpage']      = false;
$wgGroupPermissions['*']['createtalk']      = false;

So since posting my question, I just found AccessControl not commented out. When properly commented it out, voila! It started working!

So it appears that the MediaWiki extension AccessControl has some issues. I'll now go to its web page and report it.

You may need to ask your hosting provider if you are using a shared hosting to increase your allowed memory or you may need to edit your php.ini file to increase it.

发布评论

评论列表(0)

  1. 暂无评论