[traceback] Duplicate entry error on reverse geocoding

VERIFIED FIXED

Status

Participation Infrastructure
Phonebook
VERIFIED FIXED
3 years ago
3 years ago

People

(Reporter: nemo, Assigned: nemo)

Tracking

2015-3.1
x86_64
Linux

Details

(Whiteboard: [kb=1654612] )

(Assignee)

Description

3 years ago
Traceback (most recent call last):

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib64/python2.6/site-packages/newrelic-2.22.1.20/newrelic/hooks/framework_django.py", line 492, in wrapper
    return wrapped(*args, **kwargs)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/views/decorators/cache.py", line 52, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "/data/www/mozillians.org/mozillians/mozillians/phonebook/views.py", line 196, in edit_profile
    if all(list(f.is_valid() for f in all_forms)):

  File "/data/www/mozillians.org/mozillians/mozillians/phonebook/views.py", line 196, in <genexpr>
    if all(list(f.is_valid() for f in all_forms)):

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/forms/forms.py", line 129, in is_valid
    return self.is_bound and not bool(self.errors)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/forms/forms.py", line 121, in errors
    self.full_clean()

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/forms/forms.py", line 274, in full_clean
    self._clean_form()

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/forms/forms.py", line 300, in _clean_form
    self.cleaned_data = self.clean()

  File "/data/www/mozillians.org/mozillians/mozillians/phonebook/forms.py", line 222, in clean
    self.instance.reverse_geocode()

  File "/data/www/mozillians.org/mozillians/mozillians/users/models.py", line 589, in reverse_geocode
    result = reverse_geocode(self.lat, self.lng)

  File "/data/www/mozillians.org/mozillians/mozillians/geo/lookup.py", line 66, in reverse_geocode
    return result_to_country_region_city(result)

  File "/data/www/mozillians.org/mozillians/mozillians/geo/lookup.py", line 105, in result_to_country_region_city
    city = result_to_city(result, country, region)

  File "/data/www/mozillians.org/mozillians/mozillians/geo/lookup.py", line 197, in result_to_city
    city.save()

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/base.py", line 545, in save
    force_update=force_update, update_fields=update_fields)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/base.py", line 573, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/base.py", line 635, in _save_table
    forced_update)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/base.py", line 679, in _do_update
    return filtered._update(values) > 0

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/query.py", line 510, in _update
    return query.get_compiler(self.db).execute_sql(None)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/sql/compiler.py", line 980, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/models/sql/compiler.py", line 786, in execute_sql
    cursor.execute(sql, params)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

  File "/data/www/mozillians.org/mozillians/vendor/src/django/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)

  File "/usr/lib64/python2.6/site-packages/newrelic-2.22.1.20/newrelic/hooks/database_dbapi2.py", line 22, in execute
    *args, **kwargs)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue

IntegrityError: (1062, "Duplicate entry '7-8-Buenos Aires' for key 'geo_city_country_id_58d0dbdcc2216c4a_uniq'")
(Assignee)

Updated

3 years ago
Assignee: nobody → jgiannelos
(Assignee)

Updated

3 years ago
Whiteboard: [kb=1654612]

Comment 1

3 years ago
Commits pushed to master at https://github.com/mozilla/mozillians

https://github.com/mozilla/mozillians/commit/6dea4cbf8c31a6fe80b3ce5443b4efcda711ff51
[Fix bug 1130389] Fix UNIQUE constraint violation for "City".

* Check if duplicate city exists
* Deduplicate cities and their references if required

https://github.com/mozilla/mozillians/commit/16054735e2f6ccf6c6581a5316d2bf47f887e110
Merge pull request #1178 from johngian/1130389-duplicate-geo-lookup

[Fix bug 1130389] Fix UNIQUE constraint violation for "City".

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED

Updated

3 years ago
Version: other → next
(Assignee)

Updated

3 years ago
Status: RESOLVED → VERIFIED
(Assignee)

Updated

3 years ago
Version: next → 2015-3.1
You need to log in before you can comment on or make changes to this bug.