Last modified: 2014-10-22 06:46:37 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T58269, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56269 - Fix "Uncommitted DB writes (transaction from DatabaseBase::query)"
Fix "Uncommitted DB writes (transaction from DatabaseBase::query)"
Status: NEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Normal major with 9 votes (vote)
: 1.24.0 release
Assigned To: Nobody - You can work on this!
:
: 60047 60553 63213 64481 66311 (view as bug list)
Depends on:
Blocks: 39480
  Show dependency treegraph
 
Reported: 2013-10-28 19:36 UTC by Sam Reed (reedy)
Modified: 2014-10-22 06:46 UTC (History)
32 users (show)

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


Attachments

Description Sam Reed (reedy) 2013-10-28 19:36:17 UTC
Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (Block::newLoad)). in /usr/local/apache/common-local/php-1.23wmf1/includes/db/Database.php on line 3904

Seems to be new in 1.23wmf1, should probably be looked into
Comment 1 Dereckson 2013-10-28 23:29:33 UTC
I'm working on a new extension, and I've this behavior triggered by the localization cache when I disabled local directory cdb caching:

 Notice: Uncommitted DB writes (transaction from DatabaseBase::query (LCStore_DB::get)). in .../w/includes/db/Database.php on line 3904
Comment 2 Aaron Schulz 2013-10-28 23:47:40 UTC
I've seen it on MessageBlobStore::clear() once on my wiki.
Comment 3 Sam Reed (reedy) 2013-10-29 01:22:39 UTC
Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (WikiPage::pageData)). in /usr/local/apache/common-local/php-1.23wmf1/includes/db/Database.php on line 3904
Comment 4 Dereckson 2013-10-29 14:35:03 UTC
After some tests on a fresh wiki install, severity bumped to major, as some important functionnalities are broken: the error is also triggered after settings update (User::saveSettings) or when saving MediaWiki: messages (already hinted in previous comments). As read-only use and most edit uses still work, this is not a blocker.
Comment 5 Bartosz Dziewoński 2013-10-30 21:46:17 UTC
I'm getting this on master when trying to view the main page of my wiki.

Notice: Uncommitted DB writes (transaction from DatabaseBase::query (MessageBlobStore::clear)). in /home/WWW/matmarex/WWW/testwiki/includes/db/Database.php on line 3904
Comment 6 Bartosz Dziewoński 2013-10-30 22:34:34 UTC
Running update.php fixed it for me. This might not be a real issue after all, just a very misleading error message.
Comment 7 Bartosz Dziewoński 2013-10-30 22:37:21 UTC
(The commit with schema changes is I54124664, which would also mean this is just master, not 1.22.)
Comment 8 Greg Grossmeier 2013-11-04 23:18:33 UTC
CC'ing translatewiki folks:

Siebrand/Niklas: Are you seeing this issue on translatewiki? I hear it tends to hit these issues? We're looking for help reproducing.
Comment 9 Siebrand Mazeland 2013-11-04 23:30:05 UTC
Seeing these regularly on twn, and AFAIK we have no idea weer they come from.
Comment 10 Bartosz Dziewoński 2013-11-05 11:16:17 UTC
Siebrand, is TWN's database updated with the schema change from I54124664?
Comment 11 Niklas Laxström 2013-11-05 12:23:10 UTC
We do have the new column.
Comment 12 Siebrand Mazeland 2013-11-06 22:10:23 UTC
I've recently seen these on twn (unique occurrences):

[06-Nov-2013 03:45:38 UTC] PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (MessageGroupStats::selectRowsIdLang)). in /www/translatewiki.net/w/includes/db/Database.php on line 3988
[06-Nov-2013 09:56:22 UTC] PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (WikiPage::pageData)). in /www/translatewiki.net/w/includes/db/Database.php on line 3988
[06-Nov-2013 15:31:24 UTC] PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (User::loadFromDatabase)). in /www/translatewiki.net/w/includes/db/Database.php on line 3988
[06-Nov-2013 20:39:29 UTC] PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (ResourceLoader::preloadModuleInfo)). in /www/translatewiki.net/w/includes/db/Database.php on line 3988
Comment 13 Brad Jorsch 2013-11-07 15:35:49 UTC
I've found one way to reproduce this issue: if something causes a transaction start (likely via DBO_TRX or DBO_DEFAULT) and then something throws an exception that makes its way into MWExceptionHandler::handle, the database connection isn't properly shut down before exit() is called. Since Gerrit change #79852, this causes log messages about uncommitted DB writes when the database object is destroyed.
Comment 14 Sam Reed (reedy) 2013-11-07 17:03:32 UTC
(In reply to comment #13)
> I've found one way to reproduce this issue: if something causes a transaction
> start (likely via DBO_TRX or DBO_DEFAULT) and then something throws an
> exception that makes its way into MWExceptionHandler::handle, the database
> connection isn't properly shut down before exit() is called. Since Gerrit
> change #79852, this causes log messages about uncommitted DB writes when the
> database object is destroyed.

Of course this is a symptom rather than a cause.

And it being a recent change means it's more visible, rather than potentially failing silently in the background
Comment 15 Nemo 2013-11-22 18:03:13 UTC
Same?

<b>Notice</b>:  Uncommitted DB writes (transaction from DatabaseBase::query (LinkBatch::doQuery (for Skin::preloadExistence))). in <b>/www/dev.translatewiki.net/w/includes/db/Database.php</b> on line <b>4118</b>
http://dev.translatewiki.net/wiki/Special:ChangePassword (logged out, but not logged in)
Comment 16 James Montalvo 2013-11-30 15:28:26 UTC
Just did a fresh install using 1.22.0rc3. No extensions installed at this point. 

* Language: English
* Environmental checks, got warnings:
** Could not find APC, XCache, or WinCache
** The intl PECL extension is not available to handle Unicode normalization, falling back on slow pure-PHP implementation
* Otherwise all env checks were good
* Database: MySQL on localhost, no db table prefix, InnoDB, Binary
* Private wiki
* No license footer
* Disable outbound email (for now)
* Enable uploads, keeping defaults for deleted files and log URL
* No caching

Prior to login I see:
Notice: Uncommitted DB writes (transaction from DatabaseBase::query (MessageBlobStore::clear)). in C:\xampp\htdocs\wiki\mod\includes\db\Database.php on line 3944

I login and the error went away.

MediaWiki 1.22.0rc3 (0e84337)
PHP 5.4.7 (apache2handler)
MySQL 5.5.27
Windows 7
Comment 17 Bartosz Dziewoński 2013-12-02 22:21:36 UTC
Maybe relevant? From #mediawiki:

<songoo> MatmaRex : first i tried to add "$wgGroupPermissions['sysop']['userrights'] = true;" at end of LocalSettings.php, nothing changed, then i noticed "user_groups" table is empty (fresh mediawiki install from git) , so i tied "INSERT INTO `user_groups` (`ug_user`, `ug_group`) VALUES (1, 'sysop');" , have just one defult admnin user with ID 1 . And it worked, "Uncommitted DB writes" notice is gone, and also finnaly i can edit user right
Comment 18 Nemo 2013-12-20 11:00:45 UTC
(In reply to comment #9)
> Seeing these regularly on twn, and AFAIK we have no idea weer they come from.

FWIW, about 400 a month, or 20 % of rakkaus output.
Comment 19 Sam Reed (reedy) 2014-01-15 15:31:12 UTC
*** Bug 60047 has been marked as a duplicate of this bug. ***
Comment 20 Chris Dieringer 2014-01-19 22:33:16 UTC
Ditto.  Fresh 1.22.1 installation, setup for private.  Minimal extensions.  Able to access the home page, but cannot enter the login page without server timeout.
Comment 21 Dan Barrett 2014-01-20 00:58:01 UTC
Suggestion for someone familiar with Git (I'm not) who is experiencing the problem: you might be able to isolate the change between 1.21 and 1.22 that caused the problem by binary search:

1. Check out v 1.21 and confirm the problem is absent
2. Check out the version halfway between 1.21 and 1.22 and look for the problem. If present, check out the version halfway between 1.21 and it. If absent, check out the version halfway between 1.22 and it.
3. Continue cutting the space in half until you have 2 adjacent versions, the lower one missing the problem, and the higher one containing the problem. Report that higher version here.

I've done this before to isolate MediaWiki bugs. It takes less time than one might think.
Comment 22 Bartosz Dziewoński 2014-01-20 01:02:36 UTC
Git actually has a tool to facilitate that: http://man.cx/git-bisect
Comment 23 Kunal Mehta (Legoktm) 2014-01-29 01:22:57 UTC
*** Bug 60553 has been marked as a duplicate of this bug. ***
Comment 24 Mark A. Hershberger 2014-02-04 19:55:54 UTC
I've seen this error, too, and now someone reported it on the Support Desk (	[[Thread:Project:Support desk/Uncommitted DB writes - DB error]]).

This should be fixed in the next point release of MediaWiki.  Now, to find someone to fix it.
Comment 25 Zach 2014-02-09 13:08:13 UTC
I get this when I'm logged in and click on "preferences".

Using 1.23alpha, updated as of this post time.
Comment 26 Florian 2014-03-07 21:51:58 UTC
Same problem, error message as notice when call User::saveSettings() from external PHP file to save a new Option (setOption()). Maybe it's related to this bug, here more information:
http://stackoverflow.com/questions/22260275/mediawiki-setoption-on-own-php-page

MW 1.23wmf11
PHP 5.3.3-7+squeeze19
MySQL 5.1.73-1-log
Comment 27 Krinkle 2014-03-19 20:54:57 UTC
Recently it starts showing up for Title::getCascadeProtectionSources on twn:


PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (Title::getCascadeProtectionSources)). in /www/translatewiki.net/w/includes/db/Database.php on line 4132
Comment 28 Krinkle 2014-03-19 20:57:59 UTC
Recommending this block the 1.23.0 release. It surfaces as "only" a PHP Notice, but uncommitted db writes seem quite like a sign of bad quality code that is sufficiently low level that it could all kinds of unforeseen side effects and might leave the database in a state from which we have no way to recover from.
Comment 29 Mark A. Hershberger 2014-03-19 23:29:38 UTC
(In reply to Krinkle from comment #28)
> Recommending this block the 1.23.0 release.

Agreed.
Comment 30 Gerrit Notification Bot 2014-03-27 16:49:45 UTC
Change 121402 had a related patch set uploaded by Anomie:
Improve handling of uncommitted DB txns with "uncaught" exceptions

https://gerrit.wikimedia.org/r/121402
Comment 31 Florian 2014-03-27 17:26:40 UTC
Applied patch to all files, but in my example use of mediawiki's functions (https://bugzilla.wikimedia.org/show_bug.cgi?id=56269#c26) the patch doesn't fix the problem, same error message:
Notice: Uncommitted DB writes (transaction from DatabaseBase::query (LCStoreDB::get)). in /var/www/wiki/includes/db/Database.php on line 4147 Notice: DB transaction callbacks still pending (from User::invalidateCache, Title::invalidateCache). in /var/www/wiki/includes/db/Database.php on line 4155
Comment 32 Brad Jorsch 2014-03-27 17:47:16 UTC
(In reply to florian.schmidt.welzow from comment #31)
> Applied patch to all files, but in my example use of mediawiki's functions
> (https://bugzilla.wikimedia.org/show_bug.cgi?id=56269#c26) the patch doesn't
> fix the problem

This bug is about the error message showing up from MediaWiki itself. Your issue there is that you're not shutting down the database connections at all; it's probably best to continue discussion of your code on Stack Overflow.
Comment 33 Steven Zhong 2014-03-28 02:36:55 UTC
MW 1.22.5, new and clean install:

Notice: Uncommitted DB writes (transaction from DatabaseBase::query (MessageBlobStore::clear)). in C:\xampp\htdocs\new\includes\db\Database.php on line 3944

https://bugzilla.wikimedia.org/show_bug.cgi?id=63213
Comment 34 Andre Klapper 2014-03-28 11:40:01 UTC
*** Bug 63213 has been marked as a duplicate of this bug. ***
Comment 35 Gerrit Notification Bot 2014-03-31 16:30:36 UTC
Change 121402 merged by jenkins-bot:
Improve handling of uncommitted DB txns with "uncaught" exceptions

https://gerrit.wikimedia.org/r/121402
Comment 36 Gerrit Notification Bot 2014-04-22 15:40:44 UTC
Change 127868 had a related patch set uploaded by Aaron Schulz:
Avoid uncommitted transaction notices in thumb.php and img_auth.php

https://gerrit.wikimedia.org/r/127868
Comment 37 Gerrit Notification Bot 2014-04-22 15:46:00 UTC
Change 127868 merged by jenkins-bot:
Avoid uncommitted transaction notices in thumb.php and img_auth.php

https://gerrit.wikimedia.org/r/127868
Comment 38 Nemo 2014-04-27 16:25:33 UTC
*** Bug 64481 has been marked as a duplicate of this bug. ***
Comment 39 Nemo 2014-04-27 16:32:58 UTC
(In reply to Mark A. Hershberger from comment #29)
> (In reply to Krinkle from comment #28)
> > Recommending this block the 1.23.0 release.
> 
> Agreed.

Raising to "Highest" as we were told to do for 1.23.

Since 2014-04-16, the number of such errors on translatewiki.net has decreased to less than ten per day, for the first time since 2014-02-28. It's not clear to me what's the correlation to merged patches though.
Comment 40 Nemo 2014-05-05 06:50:11 UTC
And now it disappeared on translatewiki.net, for equally unknown reasons. The last was:

2014-04-25 19.00 -rakkaus:#mediawiki-i18n- [25-Apr-2014 16:59:57 UTC] PHP Notice:  Uncommitted DB writes (transaction from DatabaseBase::query (ResourceLoader::preloadModuleInfo)). in /www/translatewiki.net/w/includes/db/Database.php on line 4149
Comment 41 Andre Klapper 2014-05-09 15:30:09 UTC
(In reply to Nemo from comment #40 on 2014-05-05)
> And now it disappeared on translatewiki.net

The last of the four patches mentioned here was merged on 2014-04-22.

Resetting bug status to NEW, though it's unclear to me if there's more work needed or if this can be closed as FIXED now.

(In reply to Krinkle from comment #28)
> Recommending this block the 1.23.0 release.

I assume that some of the patches should be considered for backporting from git master to the REL1_23 branch?
Could somebody provide input / a recommendation for Mark and Markus?
Comment 42 Mark A. Hershberger 2014-05-09 16:35:40 UTC
(In reply to Andre Klapper from comment #41)
> (In reply to Nemo from comment #40 on 2014-05-05)
> > And now it disappeared on translatewiki.net
> 
> The last of the four patches mentioned here was merged on 2014-04-22.
> 
> Resetting bug status to NEW, though it's unclear to me if there's more work
> needed or if this can be closed as FIXED now.

I talked to Niklas and he showed me instances of this happening today on twn.

So it isn't fixed completely and there is still more work needed.

> (In reply to Krinkle from comment #28)
> > Recommending this block the 1.23.0 release.
> 
> I assume that some of the patches should be considered for backporting from
> git master to the REL1_23 branch?
> Could somebody provide input / a recommendation for Mark and Markus?

I'll try to find out from Niklas if the instance of this has at least been reduced.
Comment 43 Niklas Laxström 2014-05-09 21:50:06 UTC
It seems reduced. Output sorted manually to date order. Please note the days which have no occurrences at all.

grep 'Uncommitted DB' error* -h | cut -f 1 -d " " | sed 's/\[//g'| uniq -c 
     24 06-Apr-2014
     39 07-Apr-2014
     29 08-Apr-2014
     32 09-Apr-2014
     53 10-Apr-2014
     28 11-Apr-2014
     38 12-Apr-2014
      9 13-Apr-2014
     12 14-Apr-2014
     24 15-Apr-2014
      4 16-Apr-2014
      3 17-Apr-2014
      1 19-Apr-2014
      2 20-Apr-2014
      3 21-Apr-2014
      1 23-Apr-2014
      2 24-Apr-2014
      1 25-Apr-2014
      7 06-May-2014
      3 07-May-2014
      1 08-May-2014
      2 09-May-2014
Comment 44 Mark A. Hershberger 2014-05-09 22:18:57 UTC
I think adding the following sort would work:
  ... | sed 's/\[//g'| uniq -c | sort -k 2

This is encouraging.  Leaving bug open but moving milestone.

If someone has a quick fix and can apply it in the next week, that would still be awesome.  Still, I'm happy with what is seen here.
Comment 45 ben 2014-05-21 11:26:29 UTC
I have been trying to install MW 1.23 RC1 and I'm getting this error. The error occurs when the installer startes the database upgrade process. Replicated below for clarity:

Notice: Uncommitted DB writes (transaction from DatabaseUpdater::doUpdates). in C:\LG_WIKI_1-23\includes\db\Database.php on line 4147

I have checked the patches in the comments further up the page and they're all applied to my installation.

Somewhere, I think it was on this page, I saw someone suggested running update.php. I tried this and received a database error. I have copied the error below, including the last few lines of update.php's output. Assuming that the upgrade process in the installer runs this script, could this error be somehow causing teh first error message above?

Ben

Last few lines of output from update.php:

...up_property in table user_properties already modified by patch patch-up_property.sql.
...uploadstash table already exists.
...user_former_groups table already exists.
...index type_action already set on logging table.
...have rev_sha1 field in revision table.
...batch conversion of user_options: A database query error has occurred.
Query: UPDATE  `ew_user` SET user_name = 'BColeman',user_password = ':B:65b95335:fefb11de795fc238ad1ebd86db5d24b3',user_newpassword = '',user_newpass_time = NULL,user_real_name = 'Brendan Coleman',user_email = 'Brendan.Coleman@airbus.com',user_email_authenticated = NULL,user_touched = '20140521112253',user_token = '043afef4dd0d8dc602549dbcdf04aa79',user_email_token = '',user_email_token_expires = NULL,user_password_expires = NULL WHERE user_id = '90'
Function: User::saveSettings
Error: 1054 Unknown column 'user_password_expires' in 'field list' (localhost)
Comment 46 ben 2014-05-21 12:44:30 UTC
I managed to remove the above error by manually adding the column "user_password_expires" to the user table. I don't know enough about the structure of the MW code to check to see if update.php is checking/creating this column before trying to use it. 

For reference, I'm updating from MW 1.18.6 which lacks this column.

Ben
Comment 47 Bartosz Dziewoński 2014-05-21 13:21:11 UTC
(In reply to ben from comment #46)
> I managed to remove the above error by manually adding the column
> "user_password_expires" to the user table. I don't know enough about the
> structure of the MW code to check to see if update.php is checking/creating
> this column before trying to use it. 

It should but it doesn't, that's a separate bug that should be fixed before 1.23 release: bug 63677.
Comment 48 Bawolff (Brian Wolff) 2014-05-21 13:39:07 UTC
(In reply to Nemo from comment #40)
> And now it disappeared on translatewiki.net, for equally unknown reasons.
> The last was:
> 
> 2014-04-25 19.00 -rakkaus:#mediawiki-i18n- [25-Apr-2014 16:59:57 UTC] PHP
> Notice:  Uncommitted DB writes (transaction from DatabaseBase::query
> (ResourceLoader::preloadModuleInfo)). in
> /www/translatewiki.net/w/includes/db/Database.php on line 4149

Based on this and comment 45, i would guess that remaining instances are probably mostly related to exception handling in load.php and update.php entry points (the update one is probably fine as is.)
Comment 49 Daniel Renfro 2014-05-21 17:03:55 UTC
I am seeing a very large number of these errors on my clustered MediaWiki instance. Something like 6000 errors per day per server (about 4 per minute.)

   7104 May 18
  24986 May 19
  24608 May 20
  13899 May 21

All of them (a full 100%) report an uncommitted txn in the localization cache:

 Uncommitted DB writes (transaction from DatabaseBase::query (LCStore_DB::get)).

I find this quite odd, as the LCStore_DB::get() method simply fetches something from the cache (the l10n_cache table in the database) and does no writing whatsoever. This might be a red-herring, though. Everything *seems* to be OK with the wiki installation, but I'm wary of these errors.

Any ideas?
Comment 50 Nemo 2014-05-21 17:10:20 UTC
(In reply to Daniel Renfro from comment #49)
> All of them (a full 100%) report an uncommitted txn in the localization
> cache:

To clarify, what's your [[mw:Manual:Cache]] config, is $wgCacheDirectory not set?
Comment 51 Daniel Renfro 2014-05-21 17:58:42 UTC
I'm using Memcached for the general object cache because I've got multiple webservers and would like to share stuff (including session-data) across all of them. 

  $wgMainCacheType = CACHE_MEMCACHED;
  $wgMemCachedServers = array(  ...server list here...  );
  $wgSessionsInObjectCache = true;
 
For the localization cache, everything is default. Of my reading from [[mw:Manual:$wgLocalisationCacheConf]], the localization cache layer should be using the database (which it looks like it is.) 

I'm stumped.
Comment 52 Gerrit Notification Bot 2014-05-21 18:48:00 UTC
Change 134662 had a related patch set uploaded by MarkAHershberger:
Avoid uncommitted transaction notices in thumb.php and img_auth.php

https://gerrit.wikimedia.org/r/134662
Comment 53 Gerrit Notification Bot 2014-05-21 18:52:19 UTC
Change 134662 merged by jenkins-bot:
Avoid uncommitted transaction notices in thumb.php and img_auth.php

https://gerrit.wikimedia.org/r/134662
Comment 54 Danny 2014-05-28 18:57:25 UTC
Don't know if this is same problem, but when I go to main page I get: 
Internal error
[ff1c5836] 2014-05-28 18:54:15: Fatal exception of type MWException

and at the bottom: Notice: Uncommitted DB writes (transaction from DatabaseBase::query (WikiPage::pageData)). in /home/dwrice/uncool/wiki/includes/db/Database.php on line 3944

This started after I added Scribunto and the copied the Module:Citation/CS1/* pages from wikipedia
Comment 55 Dan Barrett 2014-05-30 15:37:15 UTC
I'm getting these errors as of today in 1.22.5 when we try to delete an article. See my comment number 11 in bug 47375 for the error log, which includes both "Uncommitted DB writes" and "DB transaction callbacks still pending."
Comment 56 Mark A. Hershberger 2014-05-30 19:13:04 UTC
(In reply to Dan Barrett from comment #55)
> I'm getting these errors as of today in 1.22.5 when we try to delete an
> article. See my comment number 11 in bug 47375 for the error log, which
> includes both "Uncommitted DB writes" and "DB transaction callbacks still
> pending."

When did you install 1.22.5?   What was installed before?  If you install 1.22.7, does the problem disappear?
Comment 57 Dan Barrett 2014-05-30 19:29:44 UTC
We installed 1.22.5 about a month ago. We did not experience problems with deletes until today, and the problem has gone away.

Before that, we had 1.21.x.

When we get a chance to install 1.22.7, I'll let you know what happens. (It's a production environment and we have to schedule these things.)
Comment 58 Andre Klapper 2014-06-07 12:02:31 UTC
*** Bug 66311 has been marked as a duplicate of this bug. ***
Comment 59 adamr_carter 2014-07-01 10:42:19 UTC
Frequently getting this on 1.23.0, with WikiPage::pageData. Was getting it before on 1.22.x too.
Comment 60 Stefahn 2014-07-18 09:18:48 UTC
I just got this error when I set $wgShowIPinHeader = false; in my LocalSettings.php. I'm on a brand new 1.23.1 install.
Maybe this info helps fixing the bug.

This is the error I get:
Notice: Uncommitted DB writes (transaction from DatabaseBase::query (LCStoreDB::get)). in /html/mw_test/mediawiki/includes/db/Database.php on line 4147

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


Navigation
Links