Skip to content

3 stack limit tests failing on Alpinelinux PHP 8.3 #12643

Closed

Description

@andypost

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

Activity

  1. andypost commented on Nov 10, 2023

    @andypost
    ContributorAuthor

    Probably @arnaud-lb is the author

  2. andypost commented on Nov 10, 2023

    @andypost
    ContributorAuthor

    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========
    
  3. arnaud-lb commented on Nov 10, 2023

    @arnaud-lb
    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());'
    
  4. self-assigned this
    on Nov 10, 2023
  5. andypost commented on Nov 10, 2023

    @andypost
    ContributorAuthor

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

  6. andypost commented on Nov 10, 2023

    @andypost
    ContributorAuthor
  7. andypost commented on Nov 10, 2023

    @andypost
    ContributorAuthor

    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

  8. arnaud-lb commented on Nov 11, 2023

    @arnaud-lb
    Member

    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

  9. added a commit that references this issue on Nov 11, 2023
    bcd7207
  10. andypost commented on Nov 11, 2023

    @andypost
    ContributorAuthor

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

    PS: good to know that bug was in tests)

  11. changed the title [-]3 stack limit tests failing on Alpinelinux[/-] [+]3 stack limit tests failing on Alpinelinux PHP 8.3[/+] on Nov 20, 2023
  12. bukka commented on Nov 23, 2023

    @bukka
    Member

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

  13. added a commit that references this issue on Dec 10, 2023
    dad6912
  14. added a commit that references this issue on Dec 10, 2023
    3c3aba1
  15. andypost commented on Dec 10, 2023

    @andypost
    ContributorAuthor

    Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions