Repository navigation
bug64539-status-json-encoding.phpt fail on 32-bits #17208
Copy link
Copy link
Closed
Description
Description
The following test fails on 32-bit arches building 8.4.2 for Alpinelinux https://gitlab.alpinelinux.org/alpine/aports/-/pipelines/283003
TEST 18384/18580 [sapi/fpm/tests/bug64539-status-json-encoding.phpt]
========DIFF========
001+ >>> Response
002+ ----------------- OUT -----------------
003+ X-Powered-By: PHP/8.4.2
004+ Expires: Thu, 01 Jan 1970 00:00:00 GMT
005+ Cache-Control: no-cache, no-store, must-revalidate, max-age=0
006+ Content-Type: application/json
007+
008+ {"pool":"unconfined","process manager":"static","start time":1734469914,"start since":0,"accepted conn":2,"listen queue":0,"max listen queue":0,"listen queue len":4096,"idle processes":0,"active processes":2,"total processes":2,"max active processes":2,"max children reached":0,"slow requests":0,"memory peak":0, "processes":[{"pid":18046,"state":"Running","start time":1734469914,"start since":0,"requests":1,"request duration":100588,"request method":"(null)","request uri":"GET/bug64539-status-json-encoding.src.php?","content length":4154871857,"user":"(null)","script":"-","last request cpu":0.00,"last request memory":0},{"pid":18047,"state":"Running","start time":1734469914,"start since":0,"requests":1,"request duration":361,"request method":"(null)","request uri":"GET/status?","content length":4154871857,"user":"(null)","script":"-","last request cpu":0.00,"last request memory":0}]}
009+ ----------------- ERR -----------------
010+
011+ ---------------------------------------
012+
013+ ERROR: No field request uri matched pattern \?a=b"c$ for any process in status data '{"pool":"unconfined","process manager":"static","start time":1734469914,"start since":0,"accepted conn":2,"listen queue":0,"max listen queue":0,"listen queue len":4096,"idle processes":0,"active processes":2,"total processes":2,"max active processes":2,"max children reached":0,"slow requests":0,"memory peak":0, "processes":[{"pid":18046,"state":"Running","start time":1734469914,"start since":0,"requests":1,"request duration":100588,"request method":"(null)","request uri":"GET/bug64539-status-json-encoding.src.php?","content length":4154871857,"user":"(null)","script":"-","last request cpu":0.00,"last request memory":0},{"pid":18047,"state":"Running","start time":1734469914,"start since":0,"requests":1,"request duration":361,"request method":"(null)","request uri":"GET/status?","content length":4154871857,"user":"(null)","script":"-","last request cpu":0.00,"last request memory":0}]}'
014+
015+ LOGS:
016+ --------------------------------------------------------------------
017+ [17-Dec-2024 21:11:54] NOTICE: fpm is running, pid 18045
018+ [17-Dec-2024 21:11:54] NOTICE: ready to handle connections
019+ --------------------------------------------------------------------
020+
Done
========DONE========
FAIL FPM: bug64539 - status json format escaping [sapi/fpm/tests/bug64539-status-json-encoding.phpt]
PHP Version
PHP 8.4.2
Operating System
Alpinelinux
Activity
bukka commentedon Dec 22, 2024
Hmm, this part is really strange:
For some reason it's not getting query string. It will need some debugging. I just created #17239 which will allow printing a bit more info for this with setting
TEST_FPM_DEBUG_FILTER=bug64539env var .andypost commentedon Dec 22, 2024
Here's debug build and logs
andypost commentedon Dec 22, 2024
pipeline is https://gitlab.alpinelinux.org/alpine/aports/-/jobs/1661498
ndossche commentedon Dec 26, 2024
Was able to reproduce this in an i386/alpine container.
ndossche commentedon Dec 26, 2024
The reason this breaks is because of a type mismatch.
The following line uses fields of the timeval struct which are both 8 bytes on Alpine 32-bit, which results in a computed value of also 8 bytes:
php-src/sapi/fpm/fpm/fpm_status.c
Line 611 in b09ed9a
However, it is passed to a format string which expects 4 bytes (
unsigned longand thus the%luformat specifier is 4 bytes on Alpine 32-bit), resulting in argument corruption.Since the value is generally small, truncating to 4 bytes is sufficient to fix this.
@andypost Please try the following patch:
andypost commentedon Dec 27, 2024
@nielsdos checked your patch and the test pass, thank you!
Fix phpGH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
ndossche commentedon Dec 27, 2024
@andypost Thanks for checking, PR made!
Fix GH-17208: bug64539-status-json-encoding.phpt fail on 32-bits
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4'