Closed Bug 1301702 Opened 5 years ago Closed 5 years ago

generate-alerts "IntegrityError: (1062, "Duplicate entry '2835-135192' for key 'performance_alert_summary_id_438059dd79175615_uniq'")"

Categories

(Tree Management :: Perfherder, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: wlach)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

https://rpm.newrelic.com/accounts/677903/applications/4180461/traced_errors/9540adc0-7698-11e6-a90b-b82a72d22a14_0_6975

Traceback (most recent call last):
...
File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/perf/tasks.py", line 12, in generate_alerts
File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/perf/alerts.py", line 113, in generate_new_alerts_in_series
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/query.py", line 348, in create
File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/perf/models.py", line 285, in save
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/base.py", line 734, in save
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/base.py", line 762, in save_base
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/base.py", line 846, in _save_table
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/base.py", line 885, in _do_insert
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/query.py", line 920, in _insert
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/newrelic-2.68.0.50/newrelic/hooks/database_dbapi2.py", line 22, in execute
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/MySQLdb/cursors.py", line 226, in execute
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
 django.db.utils:IntegrityError: (1062, "Duplicate entry '2835-135192' for key 'performance_alert_summary_id_438059dd79175615_uniq'")
Flags: needinfo?(wlachance)
Looking at the code, this could happen if we had two generate alerts tasks for the same series running simultaneously. We should be able to fix it by changing the create to an update_or_create.
Assignee: nobody → wlachance
Flags: needinfo?(wlachance)
Comment on attachment 8790761 [details] [review]
[treeherder] wlach:1301702 > mozilla:master

Hey Rob, here's a simple perfherder bug for you to review to get some exposure to this part of the codebase. You might want to read up on the Django documentation for update_or_create vs. create to get an idea of what's going on.
Attachment #8790761 - Flags: review?(rwood)
Comment on attachment 8790761 [details] [review]
[treeherder] wlach:1301702 > mozilla:master

Interesting! Thanks, LGTM.
Attachment #8790761 - Flags: review?(rwood) → review+
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/04d9541f62b0da248ee973627eda9d5990a5e45e
Bug 1301702 - Fix race when creating a performance alert (server side) (#1846)
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.