Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11246 closed defect (fixed)

Fatal error on database migration with Trac v1.0.1

Reported by: ryank-inovonics Owned by: Jun Omae
Priority: highest Component: TracMigratePlugin
Severity: blocker Keywords: feedback
Cc: Trac Release: 1.0


When attempting to migrate a Trac v1.0.1 site from SQLite to PostgreSQL, got this error:

Copying tables:
ProgrammingError: Cannot operate on a closed database.
Exception AssertionError: AssertionError() in <bound method PooledConnection.__del__ of <trac.db.pool.PooledConnection object at 0x95ef324>> ignored
    attachment table...

After poking around in found that creating the new environment closes any existing database connections, namely the one for the old environment's SQLite database. Swapped the new environment creation section with old environment's database open and query. With this change the migration completed successfully. See attached diff for the changes made to

Maybe a change in behavior of environment creation in Trac 1.0.x?

Attachments (1)

admin.diff (885 bytes) - added by ryank-inovonics 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by ryank-inovonics

Attachment: admin.diff added

comment:1 Changed 5 years ago by Jun Omae

Thanks for the patch. Looks harmless. But I cannot reproduce it with Python 2.5/2.6/2.7 while migrating SQLite to PostgreSQL. Could you please provide the details of your environment?

comment:2 Changed 5 years ago by Jun Omae

Keywords: feedback added

comment:3 Changed 5 years ago by ryank-inovonics

Environment details:

  • Ubuntu 12.04
  • Python 2.7.3
  • Trac 1.0.1
  • PostgreSQL 9.1.9
  • SQLite 3.7.9 & SQLite 2.8.17

Using a Python virtualenv with these packages installed (pip list):

AdvancedTicketWorkflowPlugin (0.11dev-r9962)
argparse (1.2.1)
BlackMagicTicketTweaks (0.11r1)
distribute (0.6.38)
docutils (0.10)
flup (
Genshi (0.7)
NavAdd (0.1.1)
PlantUML (2.0dev-r12389)
psycopg2 (2.5)
Pygments (1.6)
pytz (2013b)
Trac (1.0.1)
TracAccountManager (0.4.3)
TracCustomFieldAdmin (0.2.8-r12166)
TracIniAdminPanel (1.0.1-r13010)
TracMasterTickets (3.0.5dev-r12950)
TracMigratePlugin (
TracPermRedirect (3.0)
TracWysiwyg (
wsgiref (0.1.2)

Maybe one of the Trac plugins I have installed has a side-effect of closing the open database connections on environment create?

comment:4 Changed 5 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 13348:

tracmigrate: makes migration more robust by retrieving connection after upgrade of new environment (closes #11246)

Patch by ryank-inovonics.

comment:5 Changed 5 years ago by Jun Omae

Thanks for your providing the details. Reproduced with only Trac 1.0.1, MasterTicketsPlugin and TracMigratePlugin

Great Catching! Many thanks!

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.