Error message and poster not saved

Bug #713391 reported by Danny Adair
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Griffith
New
Undecided
Unassigned

Bug Description

Using postgresql, in the "Add a new movie" dialog, I successfuly pull information from imdb.
But when I hit "Add movie" an error message pops up:

insert or update on table "movies" violates foreign key constraint "movies_poster_md5_fkey"
DETAIL: Key (poster_md5)=(c3acc3c00b80dc2f9062f539c6991486) is not present in table "posters".

When I close that popup and then hit "Add movie" again, the movie is added but without its poster. The command line then shows:

2011-02-05T10:35:47: W: Griffith(add:677): cannot read temporary file: /tmp/poster_HrpeTq.jpg

Haven't looked at the code yet. Given that the second click doesn't have a problem with the primary key, probably needs a flush "inbetween" so that the primary key becomes available. The poster not being found I guess is just because the file gets deleted during the first attempt, probably assumed it was already put in the database.

There is something else also pointing to a timing/commit issue - maybe autocommit was turned off recently?
When a field value is too long - for example "Studio" has more than 128 characters, I get an error message on the command line (clicking "Add movie" seemingly does nothing)

2011-02-05T10:58:19: E: Griffith(add:824): Unexpected problem: (DataError) value too long for type character varying(128)

In such a case I used to be able to just edit that field manually, and try again. In the current version though, a second attempt brings

Traceback (most recent call last):
  File "/usr/bin/griffith", line 334, in add_movie_db
    add.add_movie_db(self, 0)
  File "/usr/share/griffith/lib/add.py", line 645, in add_movie_db
    if session.query(db.Movie).filter_by(o_title=details['o_title']).count() > 0:
[...]
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/orm/session.py", line 233, in _assert_is_active
    "The transaction is inactive due to a rollback in a "
sqlalchemy.exc.InvalidRequestError: The transaction is inactive due to a rollback in a subtransaction. Issue rollback() to cancel the transaction.

http://www.sqlalchemy.org/trac/wiki/FAQ#Thetransactionisinactiveduetoarollbackinasubtransaction

Revision history for this message
Danny Adair (danny-adair) wrote :

If someone encounters this error, a workaround is simply to fetch the information again. The poster will be saved fine the second time.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.