Race conditions on tracing globals in jit-tracing mode in ZTS
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.2k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
Description
While testing opcache.jit=tracing with a threading extension and valgrind --tool=drd, a good number of my extension's tests started detecting race conditions in zend_jit_trace_hot_root and some other places.
I'm seeing races in the following places:
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_trace.c#L7231
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_trace.c#L7701
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_trace.c#L7731
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_trace.c#L8033
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_trace.c#L8051
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit.c#L5096
https://github.com/php/php-src/blob/PHP-8.3.13/ext/opcache/jit/zend_jit_vm_helpers.c#L899
and a few other places
Vast majority seem to have zend_jit_trace_hot_root() in the stack traces
I have a whole bunch of test outputs from my CI if these are any help. Unfortunately the traces are a bit jumbled up in some cases for whatever reason.
Basically it looks like races may occur if two threads try to perform tracing JIT at the same time.
test-results-8.3.13-valgrind-drd-opcache-jit-tracing.zip
from
https://github.com/pmmp/ext-pmmpthread/actions/runs/11915925430/job/33207393626
PHP Version
8.3.13
Operating System
ubuntu-20.04 (GitHub Actions)
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner les emplacements cités dans ext/opcache/jit/zend_jit_trace.c, zend_jit.c et zend_jit_vm_helpers.c, en vous concentrant sur zend_jit_trace_hot_root et le tracing concurrent. Reproduisez le rapport avec opcache.jit=tracing et valgrind --tool=drd en utilisant les résultats de tests liés comme contexte. La tâche est terminée lorsque les races signalées ne se produisent plus lorsque plusieurs threads effectuent du tracing JIT.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, php
- Domaine
- compilers, performance
- Type d'issue
- Bug
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100