mathjazz / pontoon

In-place localization tool
https://pontoon.mozilla.org/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Approving translation causes IntegrityError #1273

Open mathjazz opened 3 years ago

mathjazz commented 3 years ago

This issue was created automatically by a script.

Bug 1691803

Bug Reporter: @gion-andri CC: @flodolo, @mathjazz

I am trying to approve the following string: https://pontoon.mozilla.org/rm/firefox/devtools/client/perftools.ftl/?status=unreviewed&string=219744 But when I click on approve, the server responds with a 500 error.

mathjazz commented 3 years ago

Comment Author: @flodolo

I've tried to approve it and didn't get any error (also unapproved it again, in case you want to try again).

mathjazz commented 3 years ago

Comment Author: @gion-andri

Hmm, interesting. Now it works as expected. From my side this bug can be closed; I don't know if you want to have a look at your logs what caused a 500 error.

mathjazz commented 3 years ago

Comment Author: @mathjazz

We see these errors from time to time on review actions. We should get to the bottom of it.

Traceback:

Message: IntegrityError: new row for relation "base_translatedresource" violates check constraint "base_translatedresource_unreviewed_strings_29c744ec_check" DETAIL: Failing row contains (193939, -1, 47, 0, 190, 4152, 8019507, 46, 0, 0).
at line 179, /app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py,

179. _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs)
at line 544, /app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/framework_django.py,

544. wrapper return wrapped(*args, **kwargs)
at line 124, /app/pontoon/base/utils.py,

124. wrap return f(request, *args, **kwargs)
at line 21, /app/.heroku/python/lib/python3.8/site-packages/django/contrib/auth/decorators.py,

21. _wrapped_view return view_func(request, *args, **kwargs)
at line 75, /app/.heroku/python/lib/python3.8/contextlib.py,

75. inner return func(*args, **kwds)
at line 248, /app/pontoon/translations/views.py,

248. approve_translation translation.approve(user)
at line 3248, /app/pontoon/base/models.py,

3248. approve self.save()
at line 3200, /app/pontoon/base/models.py,

3200. save translatedresource.adjust_all_stats(**stats_diff)
at line 3580, /app/pontoon/base/models.py,

3580. adjust_all_stats self.adjust_stats(*args, **kwargs)
at line 471, /app/pontoon/base/models.py,

471. adjust_stats self.save(
at line 753, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py,

753. save self.save_base(using=using, force_insert=force_insert,
at line 790, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py,

790. save_base updated = self._save_table(
at line 872, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py,

872. _save_table updated = self._do_update(base_qs, using, pk_val, values, update_fields,
at line 926, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/base.py,

926. _do_update return filtered._update(values) > 0
at line 803, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/query.py,

803. _update return query.get_compiler(self.db).execute_sql(CURSOR)
at line 1522, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/sql/compiler.py,

1522. execute_sql cursor = super().execute_sql(result_type)
at line 1156, /app/.heroku/python/lib/python3.8/site-packages/django/db/models/sql/compiler.py,

1156. execute_sql cursor.execute(sql, params)
at line 66, /app/.heroku/python/lib/python3.8/site-packages/django/db/backends/utils.py,

66. execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
at line 75, /app/.heroku/python/lib/python3.8/site-packages/django/db/backends/utils.py,

75. _execute_with_wrappers return executor(sql, params, many, context)
at line 84, /app/.heroku/python/lib/python3.8/site-packages/django/db/backends/utils.py,

84. _execute return self.cursor.execute(sql, params)
at line 90, /app/.heroku/python/lib/python3.8/site-packages/django/db/utils.py,

90. __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value
at line 84, /app/.heroku/python/lib/python3.8/site-packages/django/db/backends/utils.py,

84. _execute return self.cursor.execute(sql, params)
at line 34, /app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/database_psycopg2.py,

34. execute return super(CursorWrapper, self).execute(sql, parameters, *args,
at line 24, /app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/database_dbapi2.py,

24. execute return self.__wrapped__.execute(sql, parameters,
Message: CheckViolation: new row for relation "base_translatedresource" violates check constraint "base_translatedresource_unreviewed_strings_29c744ec_check" DETAIL: Failing row contains (193939, -1, 47, 0, 190, 4152, 8019507, 46, 0, 0).
at line 84, /app/.heroku/python/lib/python3.8/site-packages/django/db/backends/utils.py,

84. _execute return self.cursor.execute(sql, params)
at line 34, /app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/database_psycopg2.py,

34. execute return super(CursorWrapper, self).execute(sql, parameters, *args,
at line 24, /app/.heroku/python/lib/python3.8/site-packages/newrelic/hooks/database_dbapi2.py,

24. execute return self.__wrapped__.execute(sql, parameters,