Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9470 closed defect (worksforme)

AttributeError: 'NoneType' object has no attribute 'rollback'

Reported by: vladsynkov@… Owned by:
Priority: normal Milestone:
Component: database backend Version: 0.12
Severity: major Keywords: transaction TracSqlHelper
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

I'm getting following error while trying to upgrade my DB.

That's happend after installing TH:ComponentDependencyPlugin

Traceback is:

2010-06-29 15:02:07,642 Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/admin/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "build/bdist.linux-i686/egg/trac/admin/console.py", line 257, in default
    return cmd_mgr.execute_command(*args)
  File "build/bdist.linux-i686/egg/trac/admin/api.py", line 123, in execute_command
    return f(*fargs)
  File "build/bdist.linux-i686/egg/trac/env.py", line 790, in _do_upgrade
    self.env.upgrade(backup=no_backup is None)
  File "build/bdist.linux-i686/egg/trac/env.py", line 533, in upgrade
    with_transaction(self)(participant.upgrade_environment)
  File "build/bdist.linux-i686/egg/trac/db/api.py", line 82, in transaction_wrapper
    ldb.rollback()
  File "build/bdist.linux-i686/egg/trac/db/util.py", line 102, in __getattr__
    return getattr(self.cnx, name)
AttributeError: 'NoneType' object has no attribute 'rollback'

Attachments (0)

Change History (11)

comment:1 by Christian Boos, 14 years ago

Component: generaldatabase backend
Description: modified (diff)
Keywords: transaction added

Interesting. I forgot to do one change after r9442:

  • trac/db/api.py

    diff --git a/trac/db/api.py b/trac/db/api.py
    a b def with_transaction(env, db=None):  
    7272        elif ldb:
    7373            fn(ldb)
    7474        else:
    75             ldb = _transaction_local.db = env.get_db_cnx()
     75            ldb = _transaction_local.db = DatabaseManager(env).get_connection()
    7676            try:
    7777                fn(ldb)
    7878                ldb.commit()

However, this omission should have been harmless. Need to investigate further.

comment:2 by anonymous, 14 years ago

I can not get my trac working becouse of this bug. What should I do?

comment:3 by Christian Boos, 14 years ago

Which Python version are you using?

comment:4 by anonymous, 14 years ago

Python 2.6

comment:5 by Christian Boos, 14 years ago

I can reproduce the problem if I do an explicit db.close() from within an upgrade_environment(self, db) method, which normally shouldn't happen.

The plugin in question doesn't even use db in that method. Are you using some other plugins?

comment:6 by anonymous, 14 years ago

Yes, I'm using TracHoursPlugin with all it's dependences (feedparser-4.1, python-dateutil-1.4.1, SilverCity-0.9.7, tracsqlhelper, TicketSidebarProviderPlugin)

Version 0, edited 14 years ago by anonymous (next)

comment:7 by anonymous, 14 years ago

Acually I've installed TH:ComponentDependencyPlugin to get work TH:TracHoursPlugin. And SetupTracHours component of TracHoursPlugin require DB upgrade.

2010-06-29 15:02:07,629 Trac[env] WARNING: Component <trachours.setup.SetupTracHours object at 0xabe302c> requires environment upgrade
Last edited 14 years ago by Christian Boos (previous) (diff)

comment:8 by Christian Boos, 14 years ago

Keywords: TracSqlHelper added
Milestone: 0.12.1
Resolution: worksforme
Status: newclosed

Looks like this was caused by TH:TracSqlHelper, see #TH7262.

comment:9 by Remy Blank, 14 years ago

Are you still going to apply the patch from comment:1?

comment:10 by Christian Boos, 14 years ago

I'd like to, but as is, it breaks the tests.

in reply to:  10 comment:11 by Christian Boos, 14 years ago

Replying to cboos:

I'd like to, but as is, it breaks the tests.

Because the tests rely on re-using a single global DatabaseManager, regardless of the actual environment used, so one possible fix would be to preset the per environment DatabaseManager instance to this global one… Not sure it's worth the additional complexity in EnvironmentStub.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.