Mailing List Archive

Re: [Wikipedia-l] Strange problems
(moving thread to tech list)

Jens Frank wrote:
> it starts happening again. Server performance is
> very slow, saving edits result in "No data"
> error popups but the page is saved.
>
> And now it says:
>
> Could not select database wikidb
>
> Commands out of sync; You can't run this command now

Well, this should hopefully start to narrow it down. Thanks for the report!

in DatabaseFunctions.php::wfGetDB():
if ( ! $wgDBconnection ) {
$wgDBconnection = mysql_pconnect( $wgDBserver, wgDBuser,
$wgDBpassword ) or die( ..... );
mysql_select_db( $wgDBname, $wgDBconnection ) or die( .... );
}

The error message comes up on the mysql_select_db, and is the first
thing we do after opening a connection; but since we're using persistent
connections, it could be left in an odd state after the last process...?

-- brion vibber (brion @ pobox.com)
Re: Re: Re: [Wikipedia-l] Strange problems [ In reply to ]
>Brion VIBBER wrote:
>> The error message comes up on the mysql_select_db, and is the
>> first thing we do after opening a connection; but since we're
>> using persistent connections, it could be left in an odd state
>> after the last process...?

> I've tweaked it so if it can't select the database, it will try
> again with a spankin' new connection (via mysql_connect()) and
> make a note in the logfile. So, with any luck, this should at
> least work around the problem.

I doubt such a band-aid will help; this looks like a symptom of
a more fundamental problem, though I don't know what it might be.
I'm afraid I'm not much of a MySQL/PHP guru either (I'd never
seen or used the language before I wrote this software), so I'm
not familiar with its capacity problems. I'm pretty confident
that they can be fixed, or else there's no way a site like
Slashdot could use them, but I'm not sure where to tweak first.
I'll have to investigate.
Re: Re: [Wikipedia-l] Strange problems [ In reply to ]
Brion VIBBER wrote:
> The error message comes up on the mysql_select_db, and is the first
> thing we do after opening a connection; but since we're using persistent
> connections, it could be left in an odd state after the last process...?

I've tweaked it so if it can't select the database, it will try again
with a spankin' new connection (via mysql_connect()) and make a note in
the logfile. So, with any luck, this should at least work around the
problem.

Restarting apache should clear the mysterious borken connections, since
the persistent connections are associated with individual child
processes. (At least, that's what the documentation leads me to believe...)

-- brion vibber (brion @ pobox.com
Re: Re: [Wikipedia-l] Strange problems [ In reply to ]
lcrocker@nupedia.com wrote:
>>Brion VIBBER wrote:
>>I've tweaked it so if it can't select the database, it will try
>>again with a spankin' new connection (via mysql_connect()) and
>>make a note in the logfile. So, with any luck, this should at
>>least work around the problem.
>
>
> I doubt such a band-aid will help; this looks like a symptom of
> a more fundamental problem, though I don't know what it might be.

Well, there's definitely _some_ root cause which I wish I could
identify, too. But, with any luck, the band-aid will keep the site
usable until we ferret it out.

> I'm afraid I'm not much of a MySQL/PHP guru either (I'd never
> seen or used the language before I wrote this software), so I'm
> not familiar with its capacity problems. I'm pretty confident
> that they can be fixed, or else there's no way a site like
> Slashdot could use them, but I'm not sure where to tweak first.
> I'll have to investigate.

Slashdot's problems with mysql are notorious. :)

-- brion vibber (brion @ pobox.com)