Mon Dec 19 14:47:11 2011
Exception when processing https://portal.ariadne-network.eu/communities/against-child-sexual-exploitation/files/add_file.html
Referer: https://portal.ariadne-network.eu/communities/against-child-sexual-exploitation/files/add_file.html
Traceback (most recent call last):
File "/srv/multikarl/production/7/eggs/karl-3.77-py2.6.egg/karl/errorlog.py", line 18, in middleware
return app(environ, start_response)
File "/srv/multikarl/production/7/eggs/repoze.retry-0.9.4-py2.6.egg/repoze/retry/__init__.py", line 88, in __call__
app_iter = self.application(environ, replace_start_response)
File "/srv/multikarl/production/7/eggs/repoze.zodbconn-0.11-py2.6.egg/repoze/zodbconn/connector.py", line 21, in __call__
result = self.next_app(environ, start_response)
File "/srv/multikarl/production/7/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py", line 47, in __call__
self.commit()
File "/srv/multikarl/production/7/eggs/repoze.tm2-1.0a5-py2.6.egg/repoze/tm/__init__.py", line 52, in commit
t.commit()
File "/srv/multikarl/production/7/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", line 329, in commit
self._commitResources()
File "/srv/multikarl/production/7/eggs/transaction-1.1.1-py2.6.egg/transaction/_transaction.py", line 441, in _commitResources
rm.tpc_begin(self)
File "/srv/multikarl/production/7/eggs/zope.sqlalchemy-0.6.1-py2.6.egg/zope/sqlalchemy/datamanager.py", line 87, in tpc_begin
self.session.flush()
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/orm/session.py", line 1473, in flush
self._flush(objects)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/orm/session.py", line 1542, in _flush
flush_context.execute()
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/orm/unitofwork.py", line 327, in execute
rec.execute(self)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/orm/unitofwork.py", line 471, in execute
uow
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/orm/mapper.py", line 2136, in _save_obj
execute(statement, multiparams)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/engine/base.py", line 1358, in execute
params)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/engine/base.py", line 1491, in _execute_clauseelement
compiled_sql, distilled_params
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/engine/base.py", line 1599, in _execute_context
context)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/engine/base.py", line 1592, in _execute_context
context)
File "/srv/multikarl/production/7/eggs/SQLAlchemy-0.7.1-py2.6-linux-i686.egg/sqlalchemy/engine/default.py", line 325, in do_execute
cursor.execute(statement, parameters)
IntegrityError: (IntegrityError) duplicate key value violates unique constraint "archived_item_pkey"
DETAIL: Key (container_id, namespace, name)=(-1436229255, , tackling-child-sexual-exploitation-action-plan.pdf) already exists.
'INSERT INTO archived_item (container_id, namespace, name, docid) VALUES (%(container_id)s, %(namespace)s, %(name)s, %(docid)s)' {'namespace': u'', 'container_id': -1436229255, 'docid': 433941317, 'name': u'tackling-child-sexual-exploitation-action-plan.pdf'}
Looking at the logs, it seems the same file was successfully uploaded 8 seconds earlier. I think the web interface tried to upload the file twice.
The IntegrityError only occurred because the transaction took a while to finish; the file did not exist in the archive when the transaction started, but the file did exist by the time the transaction was trying to commit. This kind of IntegrityError is yet another retryable error (like ZODB's ConflictError), so I think I should add IntegrityError to the list of exception types to retry.