Looks as if a storm.Connection gets stuck in STATE_DISCONNECTED ("I'm broken and will stay that way until you roll me back") instead of STATE_RECONNECT ("I'll re-open when you need me again"). We need the latter at the end of a request so that the next request can re-use the connection.
if request.method in ['GET', 'HEAD']: self.finishReadOnlyRequest(txn)
elif txn.isDoomed(): txn.abort() # Sends an abort to the database, even though
# transaction is still doomed.
else: txn.commit()
This amounts to:
if request.method == "POST" and not txn.isDoomed(): txn.commit()
else: txn.rollback()
Makes sense to me, but unfortunately storm.database.Connection.commit goes into STATE_DISCONNECTED on failure. Only a rollback can get it back to STATE_RECONNECT. So we'd need to catch disconnection errors coming out of txn.commit() and handle them by calling txn.abort() after all.
Looks as if a storm.Connection gets stuck in STATE_DISCONNECTED ("I'm broken and will stay that way until you roll me back") instead of STATE_RECONNECT ("I'll re-open when you need me again"). We need the latter at the end of a request so that the next request can re-use the connection.
The cause might be this:
canonical. launchpad. webapp. publication. LaunchpadBrowse rPublication. afterCall does...
if request.method in ['GET', 'HEAD']:
self. finishReadOnlyR equest( txn)
txn. abort() # Sends an abort to the database, even though
txn. commit( )
elif txn.isDoomed():
# transaction is still doomed.
else:
This amounts to:
if request.method == "POST" and not txn.isDoomed():
txn.commit( )
txn.rollback( )
else:
Makes sense to me, but unfortunately storm.database. Connection. commit goes into STATE_DISCONNECTED on failure. Only a rollback can get it back to STATE_RECONNECT. So we'd need to catch disconnection errors coming out of txn.commit() and handle them by calling txn.abort() after all.