Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#8324 closed defect (fixed)

Unable to install on FreeBSD (via ports) - trac upgrade failed

Reported by: Sergey Chernikov Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: postgres ports freebsd
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

DB backend is PostgreSQL 8.4.5.

Upgrading Database Creating bill_date table InternalError: current transaction is aborted, commands ignored until end of transaction block

trac.log warnings and errors for this trac-admin run:

2010-12-19 13:16:43,119 Trac[console] ERROR: Exception in trac-admin command: Traceback (most recent call last):

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/admin/console.py", line 107, in one

cmd

    rv = cmd.Cmd.onecmd(self, line) or 0

    File "/usr/local/lib/python2.6/cmd.py", line 218, in onecmd

        return self.default(line)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/admin/console.py", line 257, in def

ault

    return cmd_mgr.execute_command(*args)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/admin/api.py", line 123, in execute

_command

    return f(*fargs)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/env.py", line 790, in _do_upgrade

        self.env.upgrade(backup=no_backup is None)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/env.py", line 533, in upgrade

        with_transaction(self)(participant.upgrade_environment)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/trac/db/api.py", line 77, in transaction_wrapper

        fn(ldb)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/timingandestimationplugin/api.py", line 266, in upgrade_environment

        self.do_db_upgrade()

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/timingandestimationplugin/api.py", line 114, in do_db_upgrade

        dbhelper.set_system_value(self.env, self.db_version_key, self.db_version)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/timingandestimationplugin/dbhelper.py", line 104, in set_system_value

        value, key)

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/timingandestimationplugin/dbhelper.py", line 20, in execute_non_query

        execute_in_trans(env, (sql, params))

    File "build/bdist.freebsd-8.2-PRERELEASE-amd64/egg/timingandestimationplugin/dbhelper.py", line 58, in execute_in_trans

        raise e

InternalError?: current transaction is aborted, commands ignored until end of transaction block InternalError?: current transaction is aborted, commands ignored until end of transaction block

Attachments (0)

Change History (14)

comment:3 Changed 14 years ago by Ryan J Ollos

Description: modified (diff)

comment:4 Changed 14 years ago by Russ Tyndall

Resolution: invalid
Status: newclosed

I do not maintain the "ports" version of this plugin, but it sounds like you have the wrong version of TimingAndEstimation for trac 12. You really must run the trac12 version of this plugin against trac 12, as there were changes in trac between 11 and 12 about how transactions are managed.

It is very easy to install this package from svn (or a zip file downloaded from this site). Please see the Installation Help.

If you need more help with this, feel free to reopen or comment again.

Cheers, Russ

comment:5 Changed 14 years ago by Greg Larkin

Resolution: invalid
Status: closedreopened

Hi Russ,

I maintain the FreeBSD port for the T&E plugin. I recently upgraded the port to version 1.0.6b and tested it against SQLite before committing it to the FreeBSD ports tree. Trac 0.12 is the current version in the FreeBSD ports tree, and I have that installed locally.

After receiving a problem report in the FreeBSD PR database from the same user that opened this ticket, I discovered that the upgrade process doesn't work with a Postgres backend. I reproduced the problem like so:

trac-admin /tmp/pgtest initenv ... ... ...
# edit trac.ini to add T&E plugin
trac-admin /tmp/pgtest upgrade

This results in:

Timing and Estimation needs an upgrade
Upgrading Database
Creating bill_date table
InternalError: current transaction is aborted, commands ignored until end of transaction block

The trac.log file contains:

2010-12-22 18:18:42,479 Trac[api] DEBUG: T&E NEEDS UP?: sys:True, rep:True, stats:True, fields:True, man:True
2010-12-22 18:18:42,479 Trac[env] WARNING: Component <timingandestimationplugin.api.TimeTrackingSetupParticipant object at 
0x29eab2cc> requires environment upgrade
2010-12-22 18:18:42,480 Trac[api] DEBUG: T&E NEEDS UP?: sys:True, rep:True, stats:True, fields:True, man:True
2010-12-22 18:18:42,727 Trac[env] INFO: timingandestimationplugin.api.TimeTrackingSetupParticipant upgrading...
2010-12-22 18:18:42,740 Trac[dbhelper] ERROR: There was a problem executing sql:
SELECT value FROM system WHERE name=%s
         with parameters:('TimingAndEstimationPlugin_Db_Version',)
Exception:current transaction is aborted, commands ignored until end of 
transaction block
Traceback (most recent call last):
  File "build/bdist.freebsd-8.1-RELEASE-i386/egg/timingandestimationplugin/dbhelper.py", line 28, in get_first_row
    cur.execute(sql, params)
  File "build/bdist.freebsd-8.1-RELEASE-i386/egg/trac/db/util.py", line 65, 
in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
InternalError: current transaction is aborted, commands ignored until end 
of transaction block

I don't see why the SELECT query would have any problem, but maybe that message is a red herring? I have Postgres 8.4.5 with a default config file created by the FreeBSD port installation process.

If I can provide any other troubleshooting help or testing, please let me know.

Thank you, Greg Larkin

comment:6 Changed 14 years ago by Greg Larkin

One more note - I rolled my own "distfile" for the FreeBSD port of this plugin. It was created from the 0.12+permissions branch and can be found here: http://www.sourcehosting.net/freebsd/distfiles/timingandestimationplugin-1.0.6b.tar.gz

comment:7 Changed 14 years ago by Russ Tyndall

Keywords: postgres ports freebsd added

Hrm... There has been one minor revision since that version, but I dont think it is significant (but probably worth updating eventually).

I am currently running PG 8.4 and it is working for me on a fresh install from latest T&E revision (I just verified).

My platform is Ubuntu server, so shouldn't be super different. Can you copy your trac "about" screen to this ticket. When logged in from admin (with this plugin disabled so you can actually get to that screen), this will list versions of all relevant packages, which might point something out.

Are there any other plugins installed that could be causing the connection this plugin gets to have an aborted transaction?

This looks very much like the issues that cropped up when trac 12 first dropped (thus my initial closure of this ticket). I cant see what would be causing the first upgrade to fail yet, so am at a loss to solve this. I'm sure we will get it though.

Cheers, Russ

comment:8 Changed 14 years ago by Russ Tyndall

Also just to verify, please try running the upgrade with --no-backup

Thanks

Russ

comment:9 in reply to:  8 Changed 14 years ago by Greg Larkin

Replying to bobbysmith007:

Also just to verify, please try running the upgrade with --no-backup

Thanks

Russ

Hi Russ,

I did that, and there was no change in the behavior.

Regards, Greg

comment:10 in reply to:  7 Changed 14 years ago by Greg Larkin

Replying to bobbysmith007:

Hrm... There has been one minor revision since that version, but I dont think it is significant (but probably worth updating eventually).

I am currently running PG 8.4 and it is working for me on a fresh install from latest T&E revision (I just verified).

My platform is Ubuntu server, so shouldn't be super different. Can you copy your trac "about" screen to this ticket. When logged in from admin (with this plugin disabled so you can actually get to that screen), this will list versions of all relevant packages, which might point something out.

Are there any other plugins installed that could be causing the connection this plugin gets to have an aborted transaction?

This looks very much like the issues that cropped up when trac 12 first dropped (thus my initial closure of this ticket). I cant see what would be causing the first upgrade to fail yet, so am at a loss to solve this. I'm sure we will get it though.

Cheers, Russ

Hi Russ,

I also ran the upgrade after deinstalling all other plugins and reinstalling Trac 0.12 with only T&E 1.0.6b.

I have been running some of the queries manually in psql, and one thought is that some of the SQL statements in api.py and other source files are not terminated with ";". If one of these statements is sent to the database in a transaction, could it cause a syntax error and abort the upgrade transaction?

That still doesn't explain why it works for you, but perhaps there is some subtle PostgreSQL configuration difference between the FreeBSD and Ubuntu platform. I'm no expert in PostgreSQL so that's just a guess.

Thank you,
Greg

comment:9 Changed 14 years ago by Russ Tyndall

(In [9701]) Found a bug in nested_transaction handling, I think it is now corrected, which should resolve - re #8324

comment:10 Changed 14 years ago by Russ Tyndall

Thanks so much for your perseverance in this matter. I think that I have isolated the cause of the error (still not sure why it was not effecting my install / upgrade process, but was effecting yours). Wwhile looking through the code that was erroring, I noticed something a bit strange in surrounding code that triggered a memory of where to look for bugs.

For my future reference, here is the test script I wrote to debug this once I had an idea it was nested transactions failing:

from trac.env import Environment as E
import timingandestimationplugin as te
e = E('/var/trac/test')
te.dbhelper.get_all(e, 'SELECT 1')
te.dbhelper.get_all(e, 'SELECT 1;')
te.dbhelper.get_all(e, 'SELECT 1')

@e.with_transaction()
def fn(db):
    print te.dbhelper.execute_non_query(e, 'CREATE TABLE footest(val int);')
    print te.dbhelper.execute_non_query(e, 'INSERT INTO footest(val)VALUES(1);')
    print te.dbhelper.get_all(e, 'SELECT * from footest;')    
    try:
        print te.dbhelper.execute_in_nested_trans(\
            e, 'svpoint', ('select * from nonexistanttable',[]))
    except Exception, ex:
        print "excepted", ex
    print "A"
    print te.dbhelper.execute_non_query(e, 'INSERT INTO footest(val)VALUES(2);')
    print te.dbhelper.get_all(e, 'SELECT * from footest;')
    print te.dbhelper.execute_non_query(e, 'DROP TABLE footest;')
    print "Done"

comment:11 Changed 14 years ago by Russ Tyndall

Resolution: fixed
Status: reopenedclosed

Feel free to reopen, if you still have problems with the newest version (1.0.8b).

Thanks again, Russ

comment:12 Changed 14 years ago by Greg Larkin

Excellent, I will update the port with version 1.0.8b, test again and report back here.

Thank you,
Greg

comment:13 Changed 14 years ago by Greg Larkin

Hi Russ,

I tested the 1.0.8b version on PostgreSQL and SQLite, and they both worked fine. I updated the FreeBSD port, as seen here: http://www.freshports.org/commit.php?category=www&port=trac-timingandestimation&files=yes&message_id=201101032018.p03KIegc064612@repoman.freebsd.org

Thanks again,
Greg

comment:14 Changed 14 years ago by Russ Tyndall

Hooray!

Glad we got it straightened out :)

Russ

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.