Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks occasionally fail with Duplicate entry #22

Open
operinko opened this issue Apr 21, 2013 · 2 comments
Open

Tasks occasionally fail with Duplicate entry #22

operinko opened this issue Apr 21, 2013 · 2 comments
Labels

Comments

@operinko
Copy link

Heya,

Any idea what could be causing this?

[2013-04-21 23:56:41,435: ERROR/MainProcess] Task thing.history_updater[3bc080ed-1029-4f23-9da1-2981b52c7b79] raised exception: IntegrityError(1062, "Duplicate entry '10000002-16274-2013-04-20' for key 'thing_pricehistory_region_id_35fc85aebfeaf766_uniq'")
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 228, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/task/trace.py", line 415, in __protected_call__
    return self.run(*args, **kwargs)
  File "/var/www/evething/evething/thing/tasks/historyupdater.py", line 65, in run
    PriceHistory.objects.bulk_create(new)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 140, in bulk_create
    return self.get_query_set().bulk_create(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 419, in bulk_create
    self._batched_insert(objs_without_pk, fields, batch_size)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 868, in _batched_insert
    using=self.db)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1593, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 912, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 114, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
@madcowfred
Copy link
Owner

That shouldn't be possible at all unless you have two history_updater tasks running at the same time.. which also shouldn't ever happen. How often does this occur?

@operinko
Copy link
Author

Judging by my logs, it happens a few times / day, so it's not too big of a deal.
I've my site set up with rabbitmq-server running 3 queues (high, med, low, although I've changed some of the designations of the queued items).

I haven't noticed duplicate jobs in the db, and that's just about as much as I know how to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants