Commit graph

1175 commits

Author SHA1 Message Date
Jakub Zelenka
9b18466396
FPM: Add "pcntl" when running another test depending on pcntl 2023-06-15 17:36:00 +01:00
Mikhail Galanin
7ade242e28
sapi/fpm: add "pcntl" when running test depending pcntl_sigprocmask()
If "pcntl" is built as a shared module, the extension will not
load automatically when we spawn the FPM
2023-06-15 17:32:02 +01:00
Jakub Zelenka
aa061cd40b
Fix FPM status json encoded value test
Closes GH-11276
2023-05-19 16:20:21 +01:00
Ilija Tovilo
e31fe111a5
[skip ci] Mark frequently failing fpm test as XFAIL
Reported here: https://github.com/php/php-src/pull/11050#issuecomment-1546990346
2023-05-17 17:42:05 +02:00
Jakub Zelenka
4294e8d448
FPM: Fix memory leak for invalid primary script file handle
Closes GH-11088
2023-05-14 12:27:38 +01:00
Jakub Zelenka
5e64ead64a
Fix bug #64539: FPM status - query_string not properly JSON encoded
Closes GH-11050
2023-05-13 18:43:30 +01:00
Jakub Zelenka
102953735c
Fix GH-10461: Postpone FPM child freeing in event loop
This is to prevent after free accessing of the child event that might
happen when child is killed and the message is delivered at that same
time.

Also fixes GH-10889 and properly fixes GH-8517 that was not previously
fixed correctly.
2023-05-13 14:11:42 +01:00
Jakub Zelenka
ebb3213f79
Add FPM FCGI env Apache handler UDS test 2023-04-07 12:28:42 +01:00
Jakub Zelenka
15802dfc62 Add FPM FastCGI env var test for Apache without path info fix 2023-04-06 15:59:34 +01:00
Jakub Zelenka
0d4d471847
Fix bug #74129: Incorrect SCRIPT_NAME with apache ProxyPassMatch
This happens when there are spaces are in the path info. The reason is
that Apache decodes the path info part in the SCRIPT_NAME as per CGI
RFC. FPM tries to strip path info from the SCRIPT_NAME but the
comparison is done against SCRIPT_FILENAME which is not decoded. For
that to work we have to decode it before comparison if there is any
encoded character.

Closes GH-10869
2023-03-19 13:11:14 +00:00
Niels Dossche
f30e71cbde Destroy file_handle in fpm_main
If it's not in the CG(open_files) list, we need to destroy the file
handle ourselves.

Co-authored-by: Jakub Zelenka <bukka@php.net>

Closes GH-10707.
2023-03-18 20:54:46 +01:00
Jakub Zelenka
7d987ebbbf Fix FPM tester $scriptName logic 2023-03-17 14:55:51 +00:00
Jakub Zelenka
38d2e7ea9a
Test FPM FCGI envs with path info fix for Apache proxy pass 2023-03-17 10:42:16 +00:00
Jakub Zelenka
8cf621e0e4
Test FPM FCGI envs with path info fix for Apache proxy handler 2023-03-17 10:42:16 +00:00
Jakub Zelenka
b53b0ac2ea
Test FPM FCGI envs with path info fix for Apache proxy balancer 2023-03-17 10:42:15 +00:00
Jakub Zelenka
92d2cd5cb8
Test FPM FCGI envs without path info fix for custom source 2023-03-17 10:42:15 +00:00
Jakub Zelenka
3125155b5d
Add extra option to FPM tester for handling script filename 2023-03-17 10:42:14 +00:00
Niels Dossche
71c63723c8 Fix GH-10611: fpm_env_init_main leaks environ
Closes GH-10618.
2023-03-11 16:34:41 +01:00
Niels Dossche
ff62d117a3 Fix GH-8646: Memory leak PHP FPM 8.1
Fixes GH-8646
See https://github.com/php/php-src/issues/8646 for thorough discussion.

Interned strings that hold class entries can get a corresponding slot in map_ptr for the CE cache.
map_ptr works like a bump allocator: there is a counter which increases to allocate the next slot in the map.

For class name strings in non-opcache we have:
  - on startup: permanent + interned
  - on request: interned
For class name strings in opcache we have:
  - on startup: permanent + interned
  - on request: either not interned at all, which we can ignore because they won't get a CE cache entry
                or they were already permanent + interned
                or we get a new permanent + interned string in the opcache persistence code

Notice that the map_ptr layout always has the permanent strings first, and the request strings after.
In non-opcache, a request string may get a slot in map_ptr, and that interned request string
gets destroyed at the end of the request. The corresponding map_ptr slot can thereafter never be used again.
This causes map_ptr to keep reallocating to larger and larger sizes.

We solve it as follows:
We can check whether we had any interned request strings, which only happens in non-opcache.
If we have any, we reset map_ptr to the last permanent string.
We can't lose any permanent strings because of map_ptr's layout.

Closes GH-10783.
2023-03-07 20:16:17 +01:00
Remi Collet
b11d855dbf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  more config for new FPM tests
2023-02-14 14:14:03 +01:00
Remi Collet
e86d8704b4
more config for new FPM tests 2023-02-14 14:13:40 +01:00
Jakub Zelenka
4058d20608
Merge branch 'PHP-8.0' into PHP-8.1 2023-02-14 10:52:17 +00:00
Jakub Zelenka
716de0cff5
Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-14 10:21:23 +00:00
Niels Dossche
5b13e83074
Fix GH-10385: FPM successful config test early exit
This introduces an enum `fpm_init_return_status` to propagate the status
up to fpm_main. This also makes the code clearer by not using magic
integer return numbers.

Closes GH-10388
2023-02-05 13:07:29 +00:00
Jakub Zelenka
4199b72c50
Fix GH-10315: FPM unknown child alert not valid
This changes the log level for an unknown child during wait as this is
not unuasual if FPM master has pid 1 and also possible in some cases
for higher pid processes. Based on that and the fact that this is not
really a problem, there is just a debug level message emitted for pid 1
and for higher pid a warning is emitted.

Closes GH-10319
2023-02-05 12:36:02 +00:00
Jakub Zelenka
7d98e3e40c
Fix missing comment in FPM www.conf.in 2023-01-14 15:13:55 +00:00
Jakub Zelenka
120aafcc42
Fix bug #67244: Wrong owner:group for listening unix socket
Update FPM www.conf to reflect the actual logic
2023-01-13 10:31:01 +00:00
Jakub Zelenka
a3891d9d1a
Fix GH-9981: FPM does not reset fastcgi.error_header 2022-12-25 14:44:25 +00:00
Jakub Zelenka
c9c1934ff0
Fix GH-8517: FPM child pointer can be potentially uninitialized
There might be a moment when the child log event is executed after
freeing a child. That could possibly happen if the child output is
triggered at the same as the terminating of the child. Then the output
event could be potentially processed after the terminating event which
would cause this kind of issue.

The issue might got more visible after introducing the log_stream on
a child because it is more likely that this cannot be dereferenced
after free. However it is very hard to reproduce this issue so there
is no test for this.

The fix basically prevents passing a child pointer and instead passes
the child PID and then looks the child up by the PID when it is being
processed. This is obviously slower but it is a safe way to do it and
the slow down should not be hopefully visible in a way that it would
overload a master process.
2022-11-23 11:25:51 +00:00
Jakub Zelenka
5a4520bc2b
Fix bug #68207: Setting fastcgi.error_header can result in a WARNING 2022-11-22 18:17:16 +00:00
Jakub Zelenka
31b20f1737
Merge branch 'PHP-8.0' into PHP-8.1 2022-11-22 18:02:11 +00:00
Petr Sumbera
72da2b02e2
php-fpm: fix Solaris port events.mechanism
Closes GH-9959.
2022-11-22 18:01:15 +00:00
Jakub Zelenka
b8c1b5e9fa Merge branch 'PHP-8.0' into PHP-8.1 2022-11-13 19:06:10 +00:00
Jakub Zelenka
db2d32f476 Introduce TEST_FPM_EXTENSION_DIR for FPM tests with shared extensions 2022-11-13 19:04:43 +00:00
Jakub Zelenka
a04a021105
Merge branch 'PHP-8.0' into PHP-8.1 2022-10-30 17:02:08 +00:00
Jakub Zelenka
8229649045
Fix GH-9770: Add small timeout in status-listen test
This is to allow more time to switch for active to idle in scoreboard as
it seems that Travis is quite short on resources and might not switch it
quickly enough.
2022-10-30 17:00:40 +00:00
Jakub Zelenka
29f7c4613e
Merge branch 'PHP-8.0' into PHP-8.1 2022-10-30 11:43:11 +00:00
Jakub Zelenka
1c5844aa3e
Fix GH-9754: SaltStack hangs when running php-fpm 8.1.11
SaltStack uses Python subprocess and redirects stderr to stdout which is
then piped to the returned output. If php-fpm starts in daemonized mode,
it should close stderr. However a fix introduced in GH-8913 keeps stderr
around so it can be later restored. That causes the issue reported in
GH-9754. The solution is to keep stderr around only when php-fpm runs in
foreground as the issue is most likely visible only there. Basically
there is no need to restore stderr when php-fpm is daemonized.
2022-10-30 11:41:33 +00:00
Jakub Zelenka
6d005c2cec
Merge branch 'PHP-8.0' into PHP-8.1 2022-09-29 15:30:27 +01:00
Jakub Zelenka
8e1cef4341
Do not check X-Powered-By header in FPM tester if expose_php off
Closes GH-9508
2022-09-29 15:27:33 +01:00
Jakub Zelenka
1ed4303957
Improve CS in FPM Tester Response 2022-09-29 15:24:00 +01:00
Jakub Zelenka
54cb2cdcd3
Merge branch 'PHP-8.0' into PHP-8.1 2022-09-27 17:31:08 +01:00
Jakub Zelenka
1e8fa6607d
Rework FPM tests logging for better debugging 2022-09-27 17:27:43 +01:00
Jakub Zelenka
bf97b3649d
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 22:33:02 +01:00
Jakub Zelenka
3503b1daa2
Fix bug #77780: "Headers already sent" when previous connection was aborted
This change primarily splits SAPI deactivation to module and destroy
parts. The reason is that currently some SAPIs might bail out
on deactivation. One of those SAPI is PHP-FPM that can bail out on
request end if for example the connection is closed by the client
(web sever). The problem is that in such case the resources are not
freed and some values reset. The most visible impact can have not
resetting the PG(headers_sent) which can cause erorrs in the next
request. One such issue is described in #77780 bug which this fixes
and is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
2022-08-29 22:25:53 +01:00
Jakub Zelenka
7dc3d4b510
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 16:42:58 +01:00
Jakub Zelenka
986e7319c5
Re-add fixed tests for GH-8885 2022-08-29 16:42:10 +01:00
Jakub Zelenka
36063873b0
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 16:41:19 +01:00
Jakub Zelenka
bcdd9877e1 Fix GH-8885 tests on MacOS 2022-08-29 16:40:31 +01:00
Jakub Zelenka
be45f540ee
Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 14:40:57 +01:00