Re: Another psycopg crash: "ERROR: could not serialize access due to concurrent update"
James Henstridge <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Apr 24, 2009 at 8:21 AM, Nathan <[email protected]> wrote: > Here's another problem I'm facing, though this one is less > reproducible. This sometimes occurs, and sometimes doesn't, which is > odd--especially since I'm not doing anything fancy like threads--just > straightforward loops. I don't think this is 2.0.10-specific, since > it occasionally happened with earlier versions, but the frequency of > the crash has increased enormously (from about 2% of the time to > 50-60% of the time) when I upgraded from 2.0.8 to 2.0.10. > > Does the info I included below ring a bell for anyone? That isn't a crash. It means that you are using serialised transactions, and the database can't process the concurrent transactions in a way to give the appearance that they are running in series. This sort of error is part of life when you're using serialisable transaction isolation. The usual way to handle this sort of error is to roll back and then retry the transaction. I am a little surprised that you're getting a ProgrammingError rather than the more specific TransactionRollbackError here though -- I added the code to raise a specific subclass to make it easier to catch errors where you need to retry. James.