Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 stack limit tests failing on Alpinelinux PHP 8.3 #12643

Closed
andypost opened this issue Nov 10, 2023 · 10 comments
Closed

3 stack limit tests failing on Alpinelinux PHP 8.3 #12643

andypost opened this issue Nov 10, 2023 · 10 comments
Assignees
Labels

Comments

@andypost
Copy link
Contributor

Description

Stack size tests added in #9104

The following tests started to fail when PHP using --enable-zend-test

  • Zend/tests/stack_limit/stack_limit_007.phpt
  • Zend/tests/stack_limit/stack_limit_011.phpt
  • Zend/tests/stack_limit/stack_limit_012.phpt

Resulted in this output:

TEST 4094/16862 [Zend/tests/stack_limit/stack_limit_007.phpt]
========DIFF========
001- array(4) {
002-   ["base"]=>
003-   string(%d) "0x%x"
004-   ["max_size"]=>
005-   string(%d) "0x%x"
006-   ["position"]=>
007-   string(%d) "0x%x"
008-   ["EG(stack_limit)"]=>
009-   string(%d) "0x%x"
010- }
011- Maximum call stack size of %d bytes reached. Infinite recursion?
012- Try executed: 1
001+ Fatal error: Maximum call stack size of 81920 bytes reached during compilation. Try splitting expression in /home/buildozer/aports/testing/php83/src/php-8.3.0RC6/Zend/tests/stack_limit/stack_limit_007.php on line 3
========DONE========

TEST 4098/16862 [Zend/tests/stack_limit/stack_limit_011.phpt]
========DIFF========
001- array(4) {
002-   ["base"]=>
003-   string(%d) "0x%x"
004-   ["max_size"]=>
005-   string(%d) "0x%x"
006-   ["position"]=>
007-   string(%d) "0x%x"
008-   ["EG(stack_limit)"]=>
009-   string(%d) "0x%x"
010- }
011- Maximum call stack size of %d bytes reached. Infinite recursion?
012- Previous: Maximum call stack size of %d bytes reached. Infinite recursion?
001+ Fatal error: Maximum call stack size of 81920 bytes reached during compilation. Try splitting expression in /home/buildozer/aports/testing/php83/src/php-8.3.0RC6/Zend/tests/stack_limit/stack_limit_011.php on line 3
========DONE========

TEST 4099/16862 [Zend/tests/stack_limit/stack_limit_012.phpt]
========DIFF========
001- array(4) {
002-   ["base"]=>
003-   string(%d) "0x%x"
004-   ["max_size"]=>
005-   string(%d) "0x%x"
006-   ["position"]=>
007-   string(%d) "0x%x"
008-   ["EG(stack_limit)"]=>
009-   string(%d) "0x%x"
010- }
011- 
     Fatal error: Maximum call stack size of %d bytes reached during compilation. Try splitting expression in %s on line %d
========DONE========

PHP Version

PHP 8.3.0RC5

Operating System

Alpinelinux

@andypost
Copy link
Contributor Author

Probably @arnaud-lb is the author

@andypost
Copy link
Contributor Author

One more test failed in CI (maybe because of some concurrency)

TEST 4090/16862 [Zend/tests/stack_limit/stack_limit_003.phpt]
========DIFF========
001- array(4) {
002-   ["base"]=>
003-   string(%d) "0x%x"
004-   ["max_size"]=>
005-   string(%d) "0x%x"
006-   ["position"]=>
007-   string(%d) "0x%x"
008-   ["EG(stack_limit)"]=>
009-   string(%d) "0x%x"
010- }
011- Maximum call stack size of %d bytes reached. Infinite recursion?
012- Maximum call stack size of %d bytes reached. Infinite recursion?
013- Maximum call stack size of %d bytes reached. Infinite recursion?
001+ Fatal error: Maximum call stack size of 81920 bytes reached during compilation. Try splitting expression in /builds/alpine/aports/testing/php83/src/php-8.3.0RC6/Zend/tests/stack_limit/stack_limit_003.php on line 3
========DONE========

@arnaud-lb
Copy link
Member

I could not reproduce this locally on Alpine 3.18 x86_64. I've configured php with CC=clang ./configure --disable-all --enable-zend-test --with-external-pcre.

The stack size in the error message Maximum call stack size of 81920 bytes reached during compilation looks suspicious. Either the stack size detection has gone wrong, or the stack size of the process is really small.

Could you share the output of these commands ?

$ ulimit -s
$ sapi/cli/php -r 'var_dump(zend_test_zend_call_stack_get());'

@arnaud-lb arnaud-lb self-assigned this Nov 10, 2023
@andypost
Copy link
Contributor Author

It is reproducible only on ppc64le arch, maybe because of byte-order

@andypost
Copy link
Contributor Author

The whole run with diff in https://gitlab.alpinelinux.org/alpine/aports/-/jobs/1176577

@andypost
Copy link
Contributor Author

andypost commented Nov 10, 2023

Default musl value is 128kb (80k prior to 1.1.21) according to https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-stack-size

arnaud-lb added a commit to arnaud-lb/php-src that referenced this issue Nov 11, 2023
These tests were setting zend.max_allowed_stack_size to a small value. On ppc64le
this value is too small and the limit may be reached too soon.
@arnaud-lb
Copy link
Member

arnaud-lb commented Nov 11, 2023

Thank you. I was able to reproduce the issue in a ppc64le VM on tests stack_limit_011.phpt and stack_limit_012.phpt.

These tests set a stack limit that is too low, so it is reached too soon on this arch.

The 81920 bytes in the error message is actually correct: this is 128KiB minus zend.reserved_stack_size (ZEND_ALLOCA_MAX_SIZE+16*1024 by default). The error message is confusing.

Could you confirm that this branch resolves the issue? PHP-8.3...arnaud-lb:php-src:gh12643

arnaud-lb added a commit to arnaud-lb/php-src that referenced this issue Nov 11, 2023
These tests were setting zend.max_allowed_stack_size to a small value. On ppc64le
this value is too small and the limit may be reached too soon.
@andypost
Copy link
Contributor Author

Thank you a lot!
Tests passed https://gitlab.alpinelinux.org/alpine/aports/-/jobs/1178440

PS: good to know that bug was in tests)

@andypost andypost changed the title 3 stack limit tests failing on Alpinelinux 3 stack limit tests failing on Alpinelinux PHP 8.3 Nov 20, 2023
@bukka
Copy link
Member

bukka commented Nov 23, 2023

@arnaud-lb might be worth to create a PR and merge it...

arnaud-lb added a commit that referenced this issue Dec 10, 2023
* PHP-8.3:
  WS
  Clarify the stack limit exception message
  Fix GH-12643: Stack limit tests failing on ppc64le
@andypost
Copy link
Contributor Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants