[PHP-BUG] Bug #81510 [NEW]: Zend/tests/bug74093.phpt does not always trigger hard_timeout

[email protected] ("ryan at arctype dot co")
Newsgroups php.bugs,php.qa
Message-ID <[email protected]>
From:             ryan at arctype dot co
Operating system: GNU Guix (Linux 5.14.3)
PHP version:      master-Git-2021-10-07 (Git)
Package:          Testing related
Bug Type:         Bug
Bug description:Zend/tests/bug74093.phpt does not always trigger hard_timeout

Description:
------------
On my machine (CPU: AMD Ryzen 5900X), this test case consistently fails.
The test tries to induce a hard_timeout, but it does not get triggered
and php exits normally under a max_execution_timeout.

I can get this test case to PASS by running other CPU intensive jobs
(for example, by compiling gcc) concurrently, which slows down the
timing enough to trigger the hard_timeout.

Naive attempts to fix the test program at Zend/tests/bug74093.phpt by
increasing the range() sizes passed into array_intersect() did not yield
any success.

Output pasted below:


$ ./sapi/cli/php run-tests.php -v Zend/tests/bug74093.phpt
=====================================================================
PHP         : /home/sundbry/projects/php-src/sapi/cli/php
PHP_SAPI    : cli
PHP_VERSION : 8.2.0-dev
ZEND_VERSION: 4.2.0-dev
PHP_OS      : Linux - Linux bb11 5.14.3 #1 SMP 1 x86_64
INI actual  : /home/sundbry/projects/php-src
More .INIs  :
---------------------------------------------------------------------
PHP         : /home/sundbry/projects/php-src/sapi/cgi/php-cgi
PHP_SAPI    : cgi-fcgi
PHP_VERSION : 8.2.0-dev
ZEND_VERSION: 4.2.0-dev
PHP_OS      : Linux - Linux bb11 5.14.3 #1 SMP 1 x86_64
INI actual  : /home/sundbry/projects/php-src
More .INIs  :
---------------------------------------------------------------------
---------------------------------------------------------------------
PHP         : /home/sundbry/projects/php-src/sapi/phpdbg/phpdbg
PHP_SAPI    : phpdbg
PHP_VERSION : 8.2.0-dev
ZEND_VERSION: 4.2.0-dev
PHP_OS      : Linux - Linux bb11 5.14.3 #1 SMP 1 x86_64
INI actual  : /home/sundbry/projects/php-src
More .INIs  :
---------------------------------------------------------------------
CWD         : /home/sundbry/projects/php-src
Extra dirs  :
VALGRIND    : Not used
=====================================================================
Running selected tests.

=================
TEST /home/sundbry/projects/php-src/Zend/tests/bug74093.phpt
TEST 1/1 [Zend/tests/bug74093.phpt]
CONTENT_LENGTH  =
CONTENT_TYPE    =
PATH_TRANSLATED =
/home/sundbry/projects/php-src/Zend/tests/bug74093.php
QUERY_STRING    =
REDIRECT_STATUS = 1
REQUEST_METHOD  = GET
SCRIPT_FILENAME =
/home/sundbry/projects/php-src/Zend/tests/bug74093.php
HTTP_COOKIE     =
COMMAND /home/sundbry/projects/php-src/sapi/cli/php    -d
"output_handler=" -d "open_basedir=" -d "disable_functions=" -d
"output_buffering=Off" -d "error_reporting=32767" -d "display_errors=1"
-d "display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d
"track_errors=0" -d "report_memleaks=1" -d "report_zend_debug=0" -d
"docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d
"error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d
"ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1"
-d "memory_limit=1G" -d "opcache.fast_shutdown=0" -d
"opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d
"opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d
"opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d
"zend.assertions=1" -d "zend.exception_ignore_args=0" -d
"zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d
"session.auto_start=0" -d "max_execution_time=1" -d "hard_timeout=1" -f
"/home/sundbry/projects/php-src/Zend/tests/bug74093.php"  2>&1
FAIL Bug #74093 (Maximum execution time of n+2 seconds exceed not
written in error_log) [Zend/tests/bug74093.phpt]
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    2 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #74093 (Maximum execution time of n+2 seconds exceed not written in
error_log) [Zend/tests/bug74093.phpt]
=====================================================================


$ sapi/cli/php    -d "output_handler=" -d "open_basedir=" -d
"disable_functions=" -d "output_buffering=Off" -d
"error_reporting=32767" -d "display_errors=1" -d
"display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d
"track_errors=0" -d "report_memleaks=1" -d "report_zend_debug=0" -d
"docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d
"error_append_string=" -d "auto_prepend_file=" -d "auto_append_file=" -d
"ignore_repeated_errors=0" -d "precision=14" -d "serialize_precision=-1"
-d "memory_limit=1G" -d "opcache.fast_shutdown=0" -d
"opcache.file_update_protection=0" -d "opcache.revalidate_freq=0" -d
"opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d
"opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d
"zend.assertions=1" -d "zend.exception_ignore_args=0" -d
"zend.exception_string_param_max_len=15" -d "short_open_tag=0" -d
"session.auto_start=0" -d "max_execution_time=1" -d "hard_timeout=1" -f
"Zend/tests/bug74093.php"

Fatal error: Maximum execution time of 1 second exceeded in
/home/sundbry/projects/php-src/Zend/tests/bug74093.php on line 6

Test script:
---------------
./sapi/cli/php run-tests.php -v Zend/tests/bug74093.phpt

Expected result:
----------------
Expected result: hard_timeout kills php and the error message matches
the expected output in the test case.

Actual result:
--------------
hard_timeout is not induced, and the test case fails.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81510&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81510&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81510&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81510&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81510&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81510&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81510&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81510&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81510&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81510&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81510&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81510&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81510&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81510&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81510&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81510&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81510&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81510&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.