crateio/crate-site — Issue #11: SharedLock issues when sync is running
Author: linovia
Created: 2012-02-06 19:49:33+00:00
State: open

Context: Ubuntu 11.10, postgresql.

Here's an example of the stacktrace I can see when running the sync:

Traceback (most recent call last):
File "/home/django/crate/local/lib/python2.7/site-packages/celery/execute/trace.py", line 47, in trace
return cls(states.SUCCESS, retval=fun(*args, **kwargs))
File "/home/django/crate/local/lib/python2.7/site-packages/celery/app/task/__init__.py", line 247, in __call__
return self.run(*args, **kwargs)
File "/home/django/crate/local/lib/python2.7/site-packages/celery/app/__init__.py", line 175, in run
return fun(*args, **kwargs)
File "/home/django/crate/crate-site/crate_project/apps/pypi/tasks.py", line 336, in process_release_data
release.save()
File "/home/django/crate/crate-site/crate_project/apps/packages/models.py", line 177, in save
return super(Release, self).save(*args, **kwargs)
File "/home/django/crate/src/django/django/db/models/base.py", line 464, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/django/crate/src/django/django/db/models/base.py", line 566, in save_base
created=(not record_exists), raw=raw, using=using)
File "/home/django/crate/src/django/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/django/crate/crate-site/crate_project/apps/packages/models.py", line 367, in version_ordering
Release.objects.filter(pk=release.pk).update(order=i)
File "/home/django/crate/src/django/django/db/models/query.py", line 533, in update
rows = query.get_compiler(self.db).execute_sql(None)
File "/home/django/crate/src/django/django/db/models/sql/compiler.py", line 986, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/home/django/crate/src/django/django/db/models/sql/compiler.py", line 818, in execute_sql
cursor.execute(sql, params)
File "/home/django/crate/src/django/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/home/django/crate/src/django/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
return self.cursor.execute(query, args)
DatabaseError: deadlock detected
DETAIL: Process 30521 waits for ShareLock on transaction 1220140; blocked by process 30523.
Process 30523 waits for ShareLock on transaction 1220141; blocked by process 30521.
HINT: See server log for query details.