Author: mike
Description:
Shortly after upgrading PHP (to 5.4.13) and MediaWiki (to 1.21.1), I saw the following line in Apache's error log:
[Mon Jun 24 07:39:43 2013] [error] FastCGI: server "/var/www/localhost/cgi-bin/php.fcgi" stderr: PHP Notice: pg_send_query(): There are results on this connection. Call pg_get_result() until it returns FALSE in /var/www/localhost/htdocs/mediawiki/includes/db/DatabasePostgres.php on line 441
Line 441 is the call to pg_send_query in here:
public function doQuery( $sql ) { if ( function_exists( 'mb_convert_encoding' ) ) { $sql = mb_convert_encoding( $sql, 'UTF-8' ); } $this->mTransactionState->check(); if( pg_send_query( $this->mConn, $sql ) === false ) { throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" ); } $this->mLastResult = pg_get_result( $this->mConn ); $this->mTransactionState->check(); $this->mAffectedRows = null; if ( pg_result_error( $this->mLastResult ) ) { return false; } return $this->mLastResult; }
I Googled and found the following thread: http://www.postgresql.org/message-id/flat/gtitqq$26l3$1@news.hub.org#gtitqq$26l3$1@news.hub.org
If I understand, PHP has detected that the results of one query are still pending when a second query is issued. To prevent this, it wants the results of each query to be cleared by *polling* pg_get_result() instead of making just a single call to that function.
Version: 1.21.x
Severity: normal