Development #44033
Internal Server Error sur l'ajout d'un lien vers une démarche dans une linklistcell
Début:
12 juin 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Non
Planning:
Non
Description
Cette trace au moment de la tentative d'ajout :
Internal Server Error: /manage/pages/58/cell/data_linklistcell-24/add-link/form-link IntegrityError at /manage/pages/58/cell/data_linklistcell-24/add-link/form-link duplicate key value violates unique constraint "wcs_wcsformcell_pkey" DETAIL: Key (id)=(59) already exists. Request Method: POST Request URL: https://roanne.icitoyen.fr/manage/pages/58/cell/data_linklistcell-24/add-link/form-link Django Version: 1.11.20 Python Executable: /usr/bin/uwsgi-core Python Version: 3.5.3 Python Path: ['.', '', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages'] Server time: ven, 12 Jui 2020 16:08:36 +0200 Installed Applications: '' Installed Middleware: '' Traceback: File "/usr/lib/python3/dist-packages/django/db/backends/utils.py" in execute 64. return self.cursor.execute(sql, params) The above exception (duplicate key value violates unique constraint "wcs_wcsformcell_pkey" DETAIL: Key (id)=(59) already exists. ) was the direct cause of the following exception: File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in inner 41. response = get_response(request) File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request) File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python3/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view 23. return view_func(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in view 68. return self.dispatch(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/combo/manager/views.py" in dispatch 648. return super(PageListCellAddLinkView, self).dispatch(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in dispatch 88. return handler(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/edit.py" in post 217. return super(BaseCreateView, self).post(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/edit.py" in post 183. return self.form_valid(form) File "/usr/lib/python3/dist-packages/combo/manager/views.py" in form_valid 665. response = super(PageListCellAddLinkView, self).form_valid(form) File "/usr/lib/python3/dist-packages/django/views/generic/edit.py" in form_valid 162. self.object = form.save() File "/usr/lib/python3/dist-packages/django/forms/models.py" in save 468. self.instance.save() File "/usr/lib/python3/dist-packages/combo/apps/wcs/models.py" in save 122. super().save(*args, **kwargs) File "/usr/lib/python3/dist-packages/django/db/models/base.py" in save 808. force_update=force_update, update_fields=update_fields) File "/usr/lib/python3/dist-packages/django/db/models/base.py" in save_base 838. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/usr/lib/python3/dist-packages/django/db/models/base.py" in _save_table 924. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/usr/lib/python3/dist-packages/django/db/models/base.py" in _do_insert 963. using=using, raw=raw) File "/usr/lib/python3/dist-packages/django/db/models/manager.py" in manager_method 85. return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/lib/python3/dist-packages/django/db/models/query.py" in _insert 1079. return query.get_compiler(using=using).execute_sql(return_id) File "/usr/lib/python3/dist-packages/django/db/models/sql/compiler.py" in execute_sql 1112. cursor.execute(sql, params) File "/usr/lib/python3/dist-packages/django/db/backends/utils.py" in execute 79. return super(CursorDebugWrapper, self).execute(sql, params) File "/usr/lib/python3/dist-packages/django/db/backends/utils.py" in execute 64. return self.cursor.execute(sql, params) File "/usr/lib/python3/dist-packages/django/db/utils.py" in __exit__ 94. six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/lib/python3/dist-packages/django/utils/six.py" in reraise 685. raise value.with_traceback(tb) File "/usr/lib/python3/dist-packages/django/db/backends/utils.py" in execute 64. return self.cursor.execute(sql, params) Exception Type: IntegrityError at /manage/pages/58/cell/data_linklistcell-24/add-link/form-link Exception Value: duplicate key value violates unique constraint "wcs_wcsformcell_pkey" DETAIL: Key (id)=(59) already exists. Request information: USER: <hidden> GET: No GET data POST: csrfmiddlewaretoken = '<hidden>' formdef_reference = '_interco_eservices:je-demande-le-mag-de-l-agglo' FILES: No FILES data COOKIES: sessionid-9e5cc5 = '<hidden>' csrftoken-9e5cc5 = '<hidden>' gadjo_sidepage_status = 'expanded' publik_portal_agent_url = 'https%3A%2F%2Fagents-roanne.icitoyen.fr%2F' a2-opened-session-adc730 = '1' publik_portal_agent_title = 'Portail%20Agent' META: CONTENT_LENGTH = '377' CONTENT_TYPE = 'multipart/form-data; boundary=---------------------------322551310216319' CSRF_COOKIE = '<hidden>' HTTP_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' HTTP_ACCEPT_ENCODING = 'gzip, deflate, br' HTTP_ACCEPT_LANGUAGE = 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' HTTP_CONNECTION = 'close' HTTP_COOKIE = <hidden> HTTP_HOST = 'roanne.icitoyen.fr' HTTP_REFERER = 'https://roanne.icitoyen.fr/manage/pages/58/' HTTP_UPGRADE_INSECURE_REQUESTS = '1' HTTP_USER_AGENT = '...'
https://sentry.entrouvert.org/entrouvert/publik/issues/2530/
Fichiers
Historique
Mis à jour par Thomas Noël il y a presque 4 ans
- Fichier trace.html trace.html ajouté
Et la trace "html" plus encore complète ci-jointe.
Mis à jour par Lauréline Guérin il y a presque 4 ans
Conséquence de l'import de page avec une cellule liste de liens.
L'import, s'il était issu d'un export, contenait des IDs pour les items de la liste de liens.
Ca a été corrigé dans #43620
Du coup, pour Roanne, on se trouve avec des cellules FormCell avec des PK supérieures au nextvall de la séquence:
combo=> select max(id) from roanne_icitoyen_fr.wcs_wcsformcell; max ----- 72 (1 ligne) combo=> SELECT nextval('roanne_icitoyen_fr.wcs_wcsformcell_id_seq'::regclass); nextval --------- 65 (1 ligne)
J'ai corrigé pour Roanne:
combo=> SELECT setval('roanne_icitoyen_fr.wcs_wcsformcell_id_seq', max(id)) FROM roanne_icitoyen_fr.wcs_wcsformcell; setval -------- 72 (1 ligne) combo=> SELECT nextval('roanne_icitoyen_fr.wcs_wcsformcell_id_seq'::regclass); nextval --------- 73 (1 ligne)
Il n'y a pas de soucis pour l'autre type d'item, LinkCell, pour ce tenant.
Je vais voir si je peux faire le tour de tous les tenants, faire un état des lieux des séquences à corriger.