MTG / freesound

The Freesound website
https://freesound.org
GNU Affero General Public License v3.0
311 stars 87 forks source link

duplicate key value violates unique constraint "sounds_sound_md5_key" #389

Closed ghost closed 11 years ago

ghost commented 11 years ago

Traceback (most recent call last):

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, _callback_args, *_callback_kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view return view_func(request, _args, *_kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py", line 217, in inner res = func(_args, *_kwargs)

File "/home/fsweb/freesound/accounts/views.py", line 375, in describe_sounds sound.save()

File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 460, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 553, in save_base result = manager._insert(values, return_id=update_pk, using=using)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 195, in _insert return insert_query(self.model, values, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 1436, in insert_query return query.get_compiler(using=using).execute_sql(return_id)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 791, in execute_sql cursor = super(SQLInsertCompiler, self).execute_sql(None)

File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 735, in execute_sql cursor.execute(sql, params)

File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args)

IntegrityError: duplicate key value violates unique constraint "sounds_sound_md5_key"

<WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {u'0-lat': [u''], u'0-tags': [u'alarm caralarm scifi atomar plant'], u'0-zoom': [u''], u'0-pack': [u''], u'0-lon': [u''], u'0-license': [u'3'], u'0-description': [u'An alarm which sounds like a caralarm in a large garage. Also for example an alarm in a powerplant or something else.'], u'submit': [u'submit and continue'], u'0-new_pack': [u'Alarms'], u'csrfmiddlewaretoken': [u'e242e7fed01a5493700839860d0299ce'], u'0-name': [u'alarm 001.wav']}>,

ghost commented 11 years ago

This should be impossible!!! I can't reproduce it in any case.

The only case I can think of is if the user did 2 requests (nearly simultaneous) and in the time needed to do the md5 check one of the requests wrote the sound in the db...

In any case we only have this error one in all our logs so I'm closing it as invalid.