Bug #81275 [Asn]: status page, contain bugus value in request duration sometimes

From: Date: Sun, 05 Sep 2021 19:23:26 +0000
Subject: Bug #81275 [Asn]: status page, contain bugus value in request duration sometimes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236426@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81275&edit=1 ID: 81275 Updated by: bukka@php.net Reported by: tsmtgdi at gmail dot com Summary: status page, contain bugus value in request duration sometimes Status: Assigned Type: Bug Package: FPM related Operating System: Suse PHP Version: 8.1Git-2021-07-19 (Git) Assigned To: bukka Block user comment: N Private report: N New Comment: Ah so it's not maybe such a theoretical issue that I thought initially. That PR looks like a potential fix indeed. I will need to test it to confirm though. Will also think about creating some test for this (most likely the slow one if possible). Previous Comments: ------------------------------------------------------------------------ [2021-08-03 13:10:14] nikic@php.net This is the PR I had in mind: https://github.com/php/php-src/pull/3188 ------------------------------------------------------------------------ [2021-08-03 13:05:24] ramsey@php.net bukka, can you take a look? nikic thinks there might already be a PR for this, but I can't find it. ------------------------------------------------------------------------ [2021-07-20 01:20:27] tsmtgdi at gmail dot com I tried doing int scoreboard_size = sizeof(struct fpm_scoreboard_s) + (scoreboard_p->nprocs) * sizeof(struct fpm_scoreboard_proc_s*); int scoreboard_nprocs_size = sizeof(struct fpm_scoreboard_proc_s) * scoreboard_p->nprocs; scoreboardCopy = (struct fpm_scoreboard_s*)emalloc(scoreboard_size + scoreboard_nprocs_size); memcpy(scoreboardCopy, scoreboard_p, scoreboard_size + scoreboard_nprocs_size); To have a full copy, both of the fpm_scoreboard_s and the array of fpm_scoreboard_proc_s, but the problem is still present. ------------------------------------------------------------------------ [2021-07-19 20:06:49] tsmtgdi at gmail dot com After reviewing the code, I think the logic is correct, the problem is in some missing mutex or sync problem, for example I discovered having a single fpm process will never trigger the error. Also I had case of [pid] => 0 [state] => (null) [start time] => 0 [start since] => 1626722020 [requests] => 0 [request duration] => 51276947114 Which is... in theory impossible What I discovered is that, the proc = *scoreboard_p->procs[i]; Is not doing a correct copy, I have stack trace in which the proc is different from the scoreboard_p->procs[0] https://pastebin.com/Hxgwq1c1 I can say that "maybe" the operation is done outside of the mutex (in fact around line 196 you have a /* copy the scoreboard not to bother other processes */ scoreboard = *scoreboard_p; fpm_unlock(scoreboard_p->lock);) I will later try to use this copy. ------------------------------------------------------------------------ [2021-07-19 18:24:19] tsmtgdi at gmail dot com I forget to add, I just compiled the php code (very easy! bravo!), and I will now try with the help of two coworker to do a patch. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=81275 -- Edit this bug report at https://bugs.php.net/bug.php?id=81275&edit=1

« previous php.bugs (#236426) next »