Page MenuHomePhabricator

PHP 5.4: Undefined property DatabasePostgres::$mTrxDoneWrites stops database writes using pgbouncer
Closed, ResolvedPublic

Description

Author: hugh

Description:
Hi,

I've installed media wiki from git, using the REL1_20 branch.

My setup is as follows (debian versions on second line in brackets, running debian wheezy):

Web server:
nginx version: nginx/1.2.1
(1.5.2-4)
PHP 5.4.4-9 (fpm-fcgi) (built: Oct 26 2012 13:10:40)
(1.5.2-4)

Database server:
stunnel 4.53 on x86_64-pc-linux-gnu platform
(1.5.2-4)
pgbouncer version 1.5.2 (compiled by <cbe@benz> at 2012-11-02 10:29:46)
(1.5.2-4)
postgresql 9.1.6
(9.1+134wheezy2)

The error I got in in my error log was:
PHP message: PHP Notice: Undefined property: DatabasePostgres::$mTrxDoneWrites in /var/www/wiki.example.com/includes/db/Database.php on line 512

The error in the pgbouncer logs was:
2012-11-22 10:07:54.054 17899 LOG C-0xafec38: wiki_example_com/wiki.example.com@unix:6432 closing because: client close request (age=0)
2012-11-22 10:07:54.054 17899 LOG S-0xae16c0: wiki_example_com/wiki.example.com@unix:5432 closing because: unclean server (age=0)

What I was trying to do, for example, was send a confirmation email to confirm the email, which tries to write the confirmation key to the database. This was not correctly written to the database, and so the link did not work.

When I add this patch (not final product! just to get it working) it works fine.
diff --git a/includes/db/Database.php b/includes/db/Database.php
index eca684a..4ef5f72 100644

  • a/includes/db/Database.php

+++ b/includes/db/Database.php
@@ -509,7 +509,7 @@ abstract class DatabaseBase implements DatabaseType {

    • @return bool */ public function writesOrCallbacksPending() {
  • return $this->mTrxLevel && ( $this->mTrxDoneWrites || $this->mTrxIdleCallbacks );

+ return true || $this->mTrxLevel && ( $this->mTrxDoneWrites || $this->mTrxIdleCallbacks );

}
 
/**

I think it could just be because of my funky setup with pgbouncer as well, but there is an undefined property which should probably get tracked down. When I get some free time I will write up a patch for it.

If you need more details like config etc, let me know.

Cheers,

Hugh


Version: 1.20.x
Severity: blocker
OS: Linux
Platform: PC

Details

Reference
bz42370

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:53 AM
bzimport set Reference to bz42370.

This bug is not Postgres-specific. I can reproduce this bug on my local installation (which uses MySQL), and the notice stopped appearing after I reverted commit 60cc0607084b5f71945956fa100abf6050684a20.

Because there are user reports (at Project:Support desk) mentioning two different versions of PHP 5.3 (and also both MySQL 5.1 and 5.5), I'm removing the "newphp" tag.

I'm thinking that change I3f1dd5fd may need to be backported to 1.20 as well, as it's the change that introduces the "private $mTrxDoneWrites = false;" line.

(In reply to comment #1)

I'm thinking that change I3f1dd5fd may need to be backported to 1.20 as well,
as it's the change that introduces the "private $mTrxDoneWrites = false;" line.

Aaron: Could you consider backporting?

(In reply to comment #3)

https://gerrit.wikimedia.org/r/36220

Did it work? See bug 42592.

  • Bug 42592 has been marked as a duplicate of this bug. ***

Note: Bug 42592 comment 11 states "This probably justifies a 1.20.2 release."

hugh wrote:

Hi all,

2c6cba79c6e1a49a7858cbad61a01d2a79a4a383 appears to fix it. As Aaron says, it looks like https://gerrit.wikimedia.org/r/#/c/24655/ will also do the same. Aaron, if you don't have time to backport it, I would be keen on giving it a go.

Cheers,

Hugh

Chris: Are there plans to provide a new 1.20.2 tarball?

Urgh. Ignore my last comment, obviously I miseed tarball release announcements.