Projet

Général

Profil

Bug #23329

limiter la longueur des noms des fichiers avec les erreurs d'appel au webservice

Ajouté par Serghei Mihai (congés, retour 15/05) il y a environ 6 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
23 avril 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Suite à une trace sur la prod de Grenoble à cause du proxy qui est en carafe:

Exception:
  type = '<type 'exceptions.OSError'>', value = '[Errno 36] File name too long: '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--coYcY1''

Stack trace (most recent call first):
  File "/usr/lib/python2.7/tempfile.py", line 249, in _mkstemp_inner
   247                 # exists, EACCES error code is returned instead of EEXIST.
   248                 continue
>  249             raise  
   250 
   251     raise IOError, (_errno.EEXIST, "No usable temporary file name found")

  locals: 
     dir = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors'
     e = OSError(36, 'File name too long')
     file = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--coYcY1'


Fichiers

filename_too_long.mail (92,6 ko) filename_too_long.mail Serghei Mihai (congés, retour 15/05), 23 avril 2018 19:06
0001-misc-add-proper-truncation-to-logged-error-ids-23329.patch (1,72 ko) 0001-misc-add-proper-truncation-to-logged-error-ids-23329.patch Frédéric Péters, 23 avril 2018 19:14

Révisions associées

Révision 0d0d357a (diff)
Ajouté par Frédéric Péters il y a environ 6 ans

misc: add proper truncation to logged error ids (#23329)

Historique

#1

Mis à jour par Frédéric Péters il y a environ 6 ans

Pourtant l'id est normalement composé ainsi :

        error.id = '%s-%s' % (
                error.first_occurence_timestamp.strftime('%Y%m%d-%H%M%S'),
                error.tech_id,
                )

Et tech_id est déjà limité en longueur :

    @property
    def tech_id(self):
        return '%s-%s-%s' % (self.formdef_id, self.workflow_id, simplify(self.summary))[:200]

(depuis #21478).

#2

Mis à jour par Frédéric Péters il y a environ 6 ans

Du coup, quelle serait la suite de la trace ? Peut-être éclairera-t-elle sur un chemin alternatif de construction d'id.

#3

Mis à jour par Serghei Mihai (congés, retour 15/05) il y a environ 6 ans

Extrait plus long de la trace:

Exception:
  type = '<type 'exceptions.OSError'>', value = '[Errno 36] File name too long: '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--coYcY1''

Stack trace (most recent call first):
  File "/usr/lib/python2.7/tempfile.py", line 249, in _mkstemp_inner
   247                 # exists, EACCES error code is returned instead of EEXIST.
   248                 continue
>  249             raise  
   250 
   251     raise IOError, (_errno.EEXIST, "No usable temporary file name found")

  locals: 
     dir = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors'
     e = OSError(36, 'File name too long')
     file = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--coYcY1'
     flags = 131266
     name = 'coYcY1'
     names = <tempfile._RandomNameSequence instance at 0x7f4a52efcf38>
     pre = '.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--'
     seq = 0
     suf = ''

  File "/usr/lib/python2.7/tempfile.py", line 308, in mkstemp
   306         flags = _bin_openflags
   307 
>  308     return _mkstemp_inner(dir, prefix, suffix, flags)  
   309 
   310 

  locals: 
     dir = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors'
     flags = 131266
     prefix = '.tmp-20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer--'
     suffix = ''
     text = False

  File "/usr/lib/python2.7/dist-packages/wcs/qommon/storage.py", line 65, in doit
    63         dirname = os.path.dirname(path)
    64         fd, temp = tempfile.mkstemp(dir=dirname,
>   65                 prefix='.tmp-'+os.path.basename(path)+'-')  
    66         f = os.fdopen(fd, "w")
    67         if hasattr(content, 'read'):

  locals: 
     content = '<error id="20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer-">\n  <summary>[WSCALL] ConnectionError: error in HTTP request to passerelle.demarches.lametro.fr (HTTPSConnectionPool(host=\'passerelle.demarches.lametro.fr\', port=443): Max retries exceeded with url: /grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D (Caused by ProxyError(\'Cannot connect to proxy.\', error(104, \'Connecti
 on reset by peer\'))))</summary>\n  <traceback>Exception:\n  type = \'&lt;class \'qommon.errors.ConnectionError\'&gt;\', value = \'error in HTTP request to passerelle.demarches.lametro.fr (HTTPSConnectionPool(host=\'passerelle.demarches.lametro.fr\', port=443): Max retries exceeded with url: /grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D (Caused by ProxyError(\'Cannot connect to proxy.\', error(104, \'Connection reset by peer\'))))\'\n\nStack trace (most recent call first):\n  File "/usr/lib/python2.7/dist-packages/wcs/qommon/misc.py", line 303, in _http_request\n   301         raise ConnectionError(\'connection timed out while fetching the page\')\n   302     except requests.RequestException as err:\n&gt;  303         raise ConnectionError(\'error in HTTP request to %s (%s)\' % (hostname, err))\n  
  304     else:\n   305         data = response.content\n\n  locals: \n     auth = None\n     body = None\n     cert_file = None\n     err = ProxyError(MaxRetryError("HTTPSConnectionPool(host=\'passerelle.demarches.lametro.fr\', port=443): Max retries exceeded with url: /grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D (Caused by ProxyError(\'Cannot connect to proxy.\', error(104, \'Connection reset by peer\')))",),)\n     headers = {\'Accept\': \'application/json\'}\n     hostname = \'passerelle.demarches.lametro.fr\'\n     method = \'GET\'\n     query = \'/grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D\'\n     raise_on
 _http_errors = False\n     timeout = 28\n     url = \'https://passerelle.demarches.lametro.fr/grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D\'\n\n  File "/usr/lib/python2.7/dist-packages/wcs/qommon/misc.py", line 323, in http_get_page\n   321 \n   322 def http_get_page(url, **kwargs):\n&gt;  323     return _http_request(url, **kwargs)\n   324 \n   325 def http_patch_request(url, body=None, **kwargs):\n\n  locals: \n     kwargs = {\'headers\': {\'Accept\': \'application/json\'}}\n     url = \'https://passerelle.demarches.lametro.fr/grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D\'\n\n  File "/usr/lib/python2.7/dist-pack
 ages/wcs/wscalls.py", line 115, in call_webservice\n   113     else:\n   114         response, status, data, auth_header = qommon.misc.http_get_page(\n&gt;  115                 url, headers=headers)\n   116         request = get_request()\n   117         if cache is True and request and hasattr(request, \'wscalls_cache\'):\n\n  locals: \n     cache = False\n     formdata = &lt;Signaler-Un-Dysfonctionnement-Sur-La-Voirie \'Signaler un dysfonctionnement sur la voirie - n\\xc2\\xb056-47\' id:47&gt;\n     headers = {\'Accept\': \'application/json\'}\n     key = \'orig\'\n     kwargs = {}\n     method = \'GET\'\n     orig = \'services.demarches.lametro.fr\'\n     parsed = ParseResult(scheme=\'https\', netloc=\'passerelle.demarches.lametro.fr\', path=\'/grenoble-gru/gru/demand/56-47/\', params=\'\', query=\'\', fragment=\'\')\n     payload = None\n     post_data = None\n     post_formdata = False\n     publisher = &lt;wcs.compat.CompatWcsPublisher object at 0x7f4a561ef7d0&gt;\n     qs = \
 'orig=services.demarches.lametro.fr\'\n     qs_data = {\'orig\': \'services.demarches.lametro.fr\'}\n     request_signature_key = \'9e641f165425a1c675c6650c834e594e0f9416a611364bc85d428c2bb1cdeb0f\'\n     signature_key = \'9e641f165425a1c675c6650c834e594e0f9416a611364bc85d428c2bb1cdeb0f\'\n     unsigned_url = \'https://passerelle.demarches.lametro.fr/grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr\'\n     url = \'https://passerelle.demarches.lametro.fr/grenoble-gru/gru/demand/56-47/?orig=services.demarches.lametro.fr&amp;algo=sha256&amp;timestamp=2018-04-23T09%3A20%3A13Z&amp;nonce=7acd2317183ca94c92d47bc154c5fd57&amp;signature=CBNC4sVLHOsy3KA%2Bya/fpT%2BREy4c7H%2BwvG2B7llwu%2BI%3D\'\n     value = \'services.demarches.lametro.fr\'\n     variables = {\'hobo_url\': \'https://hobo.demarches.lametro.fr/\', \'form_var_secteur_raw\': \'2\', \'form_var_secteur\': \'Nord-Est\', \'form_var_adresse_commune\': \'Corenc (38700)\', \'form_field_civilite\': \'Monsieur\', \'form_s
 ubmission_channel\': \'counter\', \'form_field_code_postal\': None, \'retour_gru_response_data_cloture_heure\': None, \'form_var_type_raw\': \'13\', \'form_f10\': None, \'form_var_adresse_signalement_voie\': \'chemin de rochasson\', \'form_var_prenom\': \'Jean-Paul\', \'retour_gru_response_data_demandeur_prenom\': \'Jean-Paul\', \'form_details\': "Objet du signalement\\xc2\\xa0:\\n  Chauss\\xc3\\xa9e\\n\\nMotif de l\'intervention\\xc2\\xa0:\\n  A reboucher\\n\\nMode de contact\\xc2\\xa0:\\n  E-mail\\n\\nMarquer en traitement URGENT\\xc2\\xa0:\\n  Non\\n\\nTraitement Guichet\\xc2\\xa0:\\n  Non\\n\\nCommune\\xc2\\xa0:\\n  Corenc (38700)\\n\\nVoie\\xc2\\xa0:\\n  chemin de rochasson\\n\\nNum\\xc3\\xa9ro\\xc2\\xa0:\\n  1\\n\\nType d\'adresse\\xc2\\xa0:\\n  voirie\\n\\nType de num\\xc3\\xa9ro\\xc2\\xa0:\\n  Toute la rue\\n\\nL\'adresse du signalement est identique \\xc3\\xa0 celle du demandeur\\xc2\\xa0:\\n  Non\\n\\nDescription d\\xc3\\xa9taill\\xc3\\xa9e\\xc2\\xa0:\\n  de nombreux trous
  dans le haut du chemin de ROCHASSON en arrivant sur CORENC village depuis de nombreux jours.\\n  Et la jonction entre Corenc et Meylan est abominable depuis tr\\xc3\\xa8s longtemps\\n  merci si vous pouviez intervenir rapidement car les voitures souffrent!!!!!!!!!!\\n  cordialement\\n  \\n\\nVous souhaitez avoir un suivi de votre demande\\xc2\\xa0:\\n  Par mail\\n\\nCivilit\\xc3\\xa9\\xc2\\xa0:\\n  Monsieur\\n\\nNom\\xc2\\xa0:\\n  TOUVIER\\n\\nPr\\xc3\\xa9nom\\xc2\\xa0:\\n  Jean-Paul\\n\\nEmail\\xc2\\xa0:\\n  jeanpaul.touvier@free.fr\\n", \'form_var_suivi_raw\': \'Par mail\', \'site_url\': \'https://services.demarches.lametro.fr\', \'form_url_backoffice\': \'http://services.demarches.lametro.fr/backoffice/management/signaler-un-dysfonctionnement-sur-la-voirie/47/\', \'theme\': \'grenoble-metropole\', \'form_number\': \'56-47\', \'form_var_type_intervention_gru\': None, \'form_f85\': \'jeanpaul.touvier@free.fr\', \'form_f86\': \'False\', \'form_option_nature_du_contact_structured\':
  None, \'form_receipt_time\': \'07:53\', \'retour_gru_response_data_transmissions_transmission_service\': \'Voirie centralis\\xc3\\xa9e - Equipe Bitume\', \'form_var_description\': \'de nombreux trous dans le haut du chemin de ROCHASSON en arrivant sur CORENC village depuis de nombreux jours.\\nEt la jonction entre Corenc et Meylan est abominable depuis tr\\xc3\\xa8s longtemps\\nmerci si vous pouviez intervenir rapidement car les voitures souffrent!!!!!!!!!!\\ncordialement\\n\', \'form_field_nom\': \'TOUVIER\', \'theme_color\': \'#FFEC44\', \'manager_homepage_title\': \'Portail agent\', \'site_lang\': \'en\', \'form_status_is_endpoint\': False, \'commune_par_insee_response_err\': 0, \'form_var_type_intervention_gru_raw\': None, \'form_var_motif_intervention_raw\': \'27\', \'envoi_gru_time\': \'2018-04-13T07:53:52.348897\', \'form_f107\': \'3\', \'form_f106\': \'1\', \'form_f105\': \'False\', \'form_f104\': \'False\', \'form_field_niveau_de_traitement_effectif\': \'GRU\', \'retour_gr
 u_response_data_IdGRU\': \'36664\', \'form_comment\': \'\', \'retour_gru_response_data_idInterne\': \'56-47\', \'resultat_sig_response_err\': 0, \'form_field_description_detaillee\': \'de nombreux trous dans le haut du chemin de ROCHASSON en arrivant sur CORENC village depuis de nombreux jours.\\nEt la jonction entre Corenc et Meylan est abominable depuis tr\\xc3\\xa8s longtemps\\nmerci si vous pouviez intervenir rapidement car les voitures souffrent!!!!!!!!!!\\ncordialement\\n\', \'form_option_nature_du_contact_raw\': \'8\', \'form_field_voie\': \'chemin de rochasson\', \'form_previous_status\': \'Demande en cours de traitement par les services techniques\', \'form_receipt_datetime\': datetime.datetime(2018, 4, 13, 7, 53, 47), \'form_role_receiver_details\': \'\', \'commune_par_insee_response_data_code_postal\': \'38700\', \'form_submission_context_agent_id\': 156, \'form_var_formulaire_fichier1_url\': None, \'retour_gru_response_data_demandeur_adresse_manuelle\': \'  \', \'form_ge
 oloc_base_lon\': 5.77015, \'retour_gru_respo [...]
     dirname = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors'
     path = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer-'
#4

Mis à jour par Frédéric Péters il y a environ 6 ans

    64         fd, temp = tempfile.mkstemp(dir=dirname,
>   65                 prefix='.tmp-'+os.path.basename(path)+'-')  

Ok c'est donc parce qu'on reprend également le chemin dans le nom du fichier temporaire.

#5

Mis à jour par Frédéric Péters il y a environ 6 ans

Mmm non.

     path = '/var/lib/wcs/services.demarches.lametro.fr/logged-errors/20180423-112013-56-42-wscall-connectionerror-error-in-http-request-to-passerelledemarcheslametrofr-httpsconnectionpoolhost-passerelledemarcheslametrofr-port443-max-retries-exceeded-with-url-grenoble-grugrudemand56-47origservicesdemarcheslametrofralgosha256timestamp2018-04-23t093a203a13znonce7acd2317183ca94c92d47bc154c5fd57signaturecbnc4svlhosy3ka2byafpt2brey4c7h2bwvg2b7llwu2bi3d-caused-by-proxyerror-cannot-connect-to-proxy-error104-connection-reset-by-peer-'

Tu peux attacher (genre en pièce jointe), toute la trace ?

#6

Mis à jour par Serghei Mihai (congés, retour 15/05) il y a environ 6 ans

Ok, le fichier avec le message complet.

#7

Mis à jour par Frédéric Péters il y a environ 6 ans

Ok, inutile, suffit d'être attentif en lisant le code.

#8

Mis à jour par Thomas Noël il y a environ 6 ans

Ack

#9

Mis à jour par Frédéric Péters il y a environ 6 ans

  • Statut changé de En cours à Résolu (à déployer)
commit 0d0d357a70d46447c5fa49bd0925ad79cd058d79
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Mon Apr 23 19:12:58 2018 +0200

    misc: add proper truncation to logged error ids (#23329)
#10

Mis à jour par Frédéric Péters il y a plus de 5 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF