Page MenuHomePhabricator

VisualEditor + PostgreSQL = transaction not committed
Closed, ResolvedPublic

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.

Event Timeline

Jdforrester-WMF changed the task status from Open to Stalled.May 31 2016, 7:18 PM
Jdforrester-WMF subscribed.

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.

@lilydjwg: Do you know if this problem still happens in a recent and supported version of MediaWiki? If yes, please add a comment to this Phabricator task and tell us your exact software version (MediaWiki and VisualEditor). Thanks!

@Aklapper No, it hasn't happened for a long time (without my workaround). Presumably it's been fixed.

Thanks for the quick reply!