php / php/php-src

dtrace probes exception__caught , exception__thrown useless without more probe arguments for context

Ouverte
#22,725 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Category: Engine Feature
Langage dominant
C
Étoiles
40.4k
Forks
8.1k
Merge moyen
2 j 13 h
PR mergées (30 j)
96

Description

Description

c.f https://www.php.net/manual/en/features.dtrace.dtrace.php

Why do the two static "exception" probes of PHP (i.e. "exception__caught" and "exception_thrown" ) offer only a single probe argument which is the exception-classname (i.e. char *classname)?

Is it some technical reason caused by the way the PHP interpreter works, or some non-technical reason? Can anyone remember the background for this?

Is it technically feasible to alter the PHP interpreter to provide additional probe-parameters specifically for both exception__thrown, and exception__caught probes? Specifically I want to see the filename, the line-number, and the exception-message if they are available, or an indicator that the exception is internally generated by PHP-interpreter.

I've been using the PHP probes with systemtap on ubuntu 24.04 and I've built PHP 8.5.8 for dtrace etc.

My use case is probing an Apache2 Wordpress site that has scores of Wordpress-plugins, at least one of which uses set_exception_handler(). Without changing any of the application code and without changing any Wordpress-plugins, I wanted to use systemtap to observe the PHP exceptions in more detail. Apache2 is the sole process using PHP, and Apache2 is serving only a single website. I used systemtap (instead of eBPF or dtrace) because I previously used it for other non PHP stuff also - although I understand all these interfaces use the same static probe points of PHP.

It is particularly useful that the other PHP probes for function__entry/return, and request__startup/return etc all offer additional probe-parameters such as the filename, line-number etc, but these incur a runtime performance-penalty which the exception-probes will not incur as exceptions rarely get thrown.

But for some reason the PHP "exception__caught" and "exception__thrown" probes only offer "ClassName" as the sole probe-parameter. In my experience that classname is almost always exactly "Exception" for the "exception__thrown" probe, which is unhelpful! It would be much more helpful if the two PHP exception-probes additionally offered the filename, the line-number, the exception-message (if all those are available, of course), specifically so that I can reconcile the "thrown" and the "caught" exceptions, plus for any thrown exceptions to also see the origin (filename + line-number, or some indication that the exception is internally generated by PHP interpreter (e.g. UnWindExit).

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par les sondes statiques exception__thrown et exception__caught de PHP, puis comparez leurs arguments documentés avec ceux des sondes function__entry/return mentionnées dans l’issue. Déterminez si le nom de fichier, le numéro de ligne, le message et le contexte de génération interne sont disponibles au niveau de chaque sonde ; le travail est terminé lorsqu’une décision de faisabilité a été prise et, si elle est acceptée, qu’une modification définie des arguments des sondes et de la documentation a été établie.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
c, php
Domaine
observability-sre
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.