VisualEditor + PostgreSQL = transaction not committed
Open, Stalled, Needs TriagePublic

Description

I have mediawiki 1.26.3 setup with VisualEditor and PostgreSQL, and find that VisualEditor won't load (the progressbar stops and after some time it asks me to retry). This request is waiting forever:

http://domain/wiki/api.php?action=visualeditor&format=json&paction=parse&page=%E9%A6%96%E9%A1%B5&uselang=zh-cn

And I can see these PostgreSQL processes:

postgres: http http [local] INSERT waiting
postgres: http http [local] INSERT waiting
postgres: http http [local] idle in transaction

Two are waiting, one idle but not committed.

I find a workaround: edit /usr/share/webapps/mediawiki/includes/db/Database.php and make the following change:

--- includes/db/Database.php     2016-03-25 19:02:16.780660734 +0800
+++ includes/db/Database.php     2016-03-28 16:45:39.341782439 +0800
@@ -1597,7 +1597,9 @@
 		$options = array(), $join_conds = array() ) {
 		$sql = $this->selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
 
-		return $this->query( $sql, $fname );
+		$ret = $this->query( $sql, $fname );
+		$this->commit();
+		return $ret;
 	}
 
 	/**

But this will make some category pages to raise errors.

lilydjwg created this task.May 27 2016, 3:03 AM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptMay 27 2016, 3:03 AM
Jdforrester-WMF changed the task status from Open to Stalled.May 31 2016, 7:18 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

There's no database code in VisualEditor. Possibly MediaWiki's Postgres support has regressed?

I think it's something VisualEditor uses but source code editing doesn't use, so it happens only with VisualEditor.