Last modified: 2014-06-23 16:06:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 50091 - PostgreSQL misuse of pg_get_result
PostgreSQL misuse of pg_get_result
Status: NEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.21.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2013-06-24 12:25 UTC by Michael Allan
Modified: 2014-06-23 16:06 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael Allan 2013-06-24 12:25:09 UTC
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.
Comment 1 Michael Allan 2013-06-24 17:04:10 UTC
I've since replicated the bug, but only in API requests aimed at Semantic MediaWiki 1.7.1 (action=ask).  Maybe that extension is the only source.

In any case, I'm now porting the affected wikis to MySQL.  SMW's support for postgres has tanked lately.
Comment 2 Marcin Cieślak 2013-07-17 14:18:50 UTC
Can you enable $wgDebugLogFile and $wgDebugDBTransactions and see what's there?
I wonder what kind of transitions do you get in this case.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links