Project

General

Profile

Bug #67075

IntegrityError: ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « authentic2_auth_oidc_oidcacco...

Added by Sentry Io 7 months ago. Updated 7 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
06 July 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/nfrance/issues/62430/

OIDCAccount.DoesNotExist: OIDCAccount matching query does not exist.
  File "django/db/models/query.py", line 538, in get_or_create
    return self.get(**kwargs), False
  File "django/db/models/query.py", line 406, in get
    raise self.model.DoesNotExist(

UniqueViolation: ERREUR:  la valeur d'une clé dupliquée rompt la contrainte unique « authentic2_auth_oidc_oidcaccount_provider_id_sub_1772a755_uniq »
DETAIL:  La clé « (provider_id, sub)=(1, yy28455) » existe déjà.

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

IntegrityError: ERREUR:  la valeur d'une clé dupliquée rompt la contrainte unique « authentic2_auth_oidc_oidcaccount_provider_id_sub_1772a755_uniq »
DETAIL:  La clé « (provider_id, sub)=(1, yy28455) » existe déjà.

(26 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

History

#1

Updated by Nicolas Roche 7 months ago

  • Project changed from Suivi des traces to Authentic 2
#3

Updated by Benjamin Dauvergne 7 months ago

Leurs sub sont bien uniques, ce sont des identifiants d'utilisateur mais le même code s'est retrouvé joué sur les deux noeuds, et donc c'est plus sûrement une race condition dans le code d'authentification.

bdauvergne@cutm-publik-prod-web1.lan.nfrance.net:/var/log/nginx$ sudo grep oidc.callback authentic2-multitenant-access.log | grep 13:3[456]
172.16.49.3 - - [06/Jul/2022:13:35:12 +0200] "GET /accounts/oidc/callback/?code=OC-1519-OwX2XFVf64AWqoOTrcrODuPho2hPPvf2&state=cZZ19NtnogXmeA6WW3o47A%3AGyr9TPlh9vTwuh6aD8kDlydGg9d5J_ozdH2urHTN5-pEKgVkUiqE8U1yQZ3Y_QjF11s-shaF5deHcG8a00q3atm0jdzsZYCY58nYaSI3nqjpfKLlnW7euh2T4KnAxIWQHIpIXIa4DT_XCVedkzmL05LOWuFvpKUu8UWeOsQQtQOMmIzRidShbVxJioBLoCEMZck7kkTSnn2RAqs8HuCxVmudbC_SeTQ2xFhq23hwoTPC6ID7LjBvH7J03cqKN8n5y_OWw-wd9Qna620PxAcow6XsbxZlTwcAv8sZ5cAyzctNpN4QWQKrPyMVgNq_y-iPdUpZrk_A3iCR870ysRl9s_SWX4zCgy_ODee6C05W4Q&nonce=2fbea5f3507b191580fc2cd7d01670f85bf8a235854f81dc433a1b915f88a5c2 HTTP/1.1" 302 0 "https://connexion.eservices.toulouse-metropole.fr/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44" "connexion.eservices.toulouse-metropole.fr" [2.987 s]

bdauvergne@cutm-publik-prod-web2.lan.nfrance.net:/var/log/nginx$ sudo grep oidc.callback authentic2-multitenant-access.log | grep 13:3[456]
172.16.49.3 - - [06/Jul/2022:13:34:56 +0200] "GET /accounts/oidc/callback/?code=OC-1519-OwX2XFVf64AWqoOTrcrODuPho2hPPvf2&state=cZZ19NtnogXmeA6WW3o47A%3AGyr9TPlh9vTwuh6aD8kDlydGg9d5J_ozdH2urHTN5-pEKgVkUiqE8U1yQZ3Y_QjF11s-shaF5deHcG8a00q3atm0jdzsZYCY58nYaSI3nqjpfKLlnW7euh2T4KnAxIWQHIpIXIa4DT_XCVedkzmL05LOWuFvpKUu8UWeOsQQtQOMmIzRidShbVxJioBLoCEMZck7kkTSnn2RAqs8HuCxVmudbC_SeTQ2xFhq23hwoTPC6ID7LjBvH7J03cqKN8n5y_OWw-wd9Qna620PxAcow6XsbxZlTwcAv8sZ5cAyzctNpN4QWQKrPyMVgNq_y-iPdUpZrk_A3iCR870ysRl9s_SWX4zCgy_ODee6C05W4Q&nonce=2fbea5f3507b191580fc2cd7d01670f85bf8a235854f81dc433a1b915f88a5c2 HTTP/1.1" 500 27 "https://connexion.eservices.toulouse-metropole.fr/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44" "connexion.eservices.toulouse-metropole.fr" [2.824 s]

Comme on dit, si ça peut arriver, ça arrivera, et donc le ticket existant serait #65412 pour éviter ça.

Also available in: Atom PDF