Last modified: 2014-06-23 16:06:56 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 T51254, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49254 - PDOException ('There is no active transaction') after upgrading SQLite database from 1.16.5 to 1.21.1 when user is set in wgDBuser
PDOException ('There is no active transaction') after upgrading SQLite databa...
Status: RESOLVED FIXED
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: sqlite
  Show dependency treegraph
 
Reported: 2013-06-06 13:58 UTC by Chris
Modified: 2014-06-23 16:06 UTC (History)
2 users (show)

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


Attachments

Description Chris 2013-06-06 13:58:25 UTC
I have a MediaWiki 1.16.5 up and running and tried to upgrade to 1.21.1. Steps done :
* created a new directory in the Apache DocRoot (test-21)
* extracted the 1.21.1 tarball into this new directory
* copied all the additional extensions from the the old installation (test-16/extensions)
* copied the LocalSettings.php from the old setup to the new one
* copied the one SQLite database container file from the old setup to a new location
* adapted the LocalSettings.php ($wgScriptPath, wgSQLiteDataDir)
* opened the test-21/mw-config/ URL
* followed the instructions up to and including the database upgrade

Everything worked fine without any errors. When following the link to open the Wiki itself, I get the following error:

Unexpected non-MediaWiki exception encountered, of type "PDOException"
exception 'PDOException' with message 'There is no active transaction' in K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\db\DatabaseSqlite.php:665
Stack trace:
#0 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\db\DatabaseSqlite.php(665): PDO->commit()
#1 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\db\Database.php(3032): DatabaseSqlite->doCommit('SqlBagOStuff::s...')
#2 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\objectcache\SqlBagOStuff.php(299): DatabaseBase->begin('SqlBagOStuff::s...')
#3 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\objectcache\BagOStuff.php(243): SqlBagOStuff->set('factwikidb:mess...', 1, 10)
#4 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\cache\MessageCache.php(576): BagOStuff->add('factwikidb:mess...', 1, 10)
#5 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\cache\MessageCache.php(330): MessageCache->lock('factwikidb:mess...')
#6 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\cache\MessageCache.php(710): MessageCache->load('en')
#7 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\cache\MessageCache.php(650): MessageCache->getMsgFromNamespace('Mainpage', 'en')
#8 K:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test-21\mediawiki-1.21.1\includes\Message.php(720): MessageCache->get('mainpage', true, Object(Language))
[...]

I also tried the following:
* Installed the 1.21.1 and created a new SQLlite DB => was working fine
* Upgrading in the same way as described above from 1.16.5 to 1.19.7 => was working fine
* Upgrading then from 1.19.7 to 1.20.6 => was working fine
* Upgrading then from 1.20.6 to 1.21.1 => FAILED AGAIN with the same type of error.
Comment 1 Chris 2013-06-07 06:30:28 UTC
Problem seems to be solved. I added some traces in the Database.php and DatabaseSqlite.php and noticed, that the DatabaseSqlite::openFile() was called twice in the transaction. After some code reading I found this section in the Database::__construct:

  if ( $user ) {
  	$this->open( $server, $user, $password, $dbName );
  }

I also found the counterpart in the DatabaseSqlite::__construct
  function __construct( $server = false, $user = false, $password = false, $dbName = false, $flags = 0 ) {
    $this->mName = $dbName;
    parent::__construct( $server, $user, $password, $dbName, $flags );
    // parent doesn't open when $user is false, but we can work with $dbName
    if( $dbName ) {
      global $wgSharedDB;
      if( $this->open( $server, $user, $password, $dbName ) && $wgSharedDB ) {

While checking the LocalSettings.php I noticed that the $wgDBuser has a user defined. After removing this, everything seems to work.

Well I checked again the settings in the 1.20.6 test setup (which was running after the upgrade) and here the$ wgDBuser was also defined

When comparing the code 1.20.6 to 1.21.1, the only difference is the PRAGMA setting in the constructor of the DatabaseSqlite:
  $this->query( 'PRAGMA case_sensitive_like = 1' );

Summary: When you do not specify a user in wgDBuser, then everything is working fine. 

Might be a good idea to check for it in the migration scripts...

CU,
Chris
Comment 2 Andre Klapper 2013-06-07 10:08:00 UTC
Glad that you found out the reason, thanks for investigating!
Reopening this as the problem itself is not fixed in the codebase.
Comment 3 Stefan Reinauer 2013-06-10 23:05:43 UTC
I am seeing the same issue on some of my sqlite driven MediaWiki instances. However, removing $wgDBUser did not make the problem go away. Commenting out $this->query( 'PRAGMA case_sensitive_like = 1' ); did solve the problem however.
Comment 4 Gerrit Notification Bot 2013-10-17 04:42:14 UTC
Change 90288 had a related patch set uploaded by Tim Starling:
Fix SQLite exception when $wgDBuser is set

https://gerrit.wikimedia.org/r/90288
Comment 5 Gerrit Notification Bot 2013-10-17 22:48:15 UTC
Change 90288 merged by jenkins-bot:
Fix SQLite exception when $wgDBuser is set

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

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


Navigation
Links