Skip to content

JIT leak in Symfony TranslationDebugCommandTest #12364

Closed
@iluuu1994

Description

@iluuu1994

Description

We get a new JIT leak in the COMMUNITY build for Symfony on PHP 8.1. https://github.com/php/php-src/actions/runs/6413467433/job/17412450113 This is exposed due to the config changes introduced in #12250.

=================================================================
==218795==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 2 object(s) allocated from:
    #0 0x7fba7226b808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
    #1 0x5591a601d1d3 in __zend_malloc /home/runner/work/php-src/php-src/Zend/zend_alloc.c:3088
    #2 0x5591a6019e17 in tracked_malloc /home/runner/work/php-src/php-src/Zend/zend_alloc.c:2799
    #3 0x5591a601758c in _malloc_custom /home/runner/work/php-src/php-src/Zend/zend_alloc.c:2459
    #4 0x5591a6017d0b in _emalloc /home/runner/work/php-src/php-src/Zend/zend_alloc.c:2578
    #5 0x5591a61dffd3 in zend_array_dup /home/runner/work/php-src/php-src/Zend/zend_hash.c:2115
    #6 0x7fba67f90167 in zend_jit_add_arrays_helper ext/opcache/jit/zend_jit_helpers.c:2476
    #7 0x7fba28051239  (<unknown module>)
    #8 0x5591a656ae74 in zend_execute /home/runner/work/php-src/php-src/Zend/zend_vm_execute.h:60164
    #9 0x5591a6161dcd in zend_execute_scripts /home/runner/work/php-src/php-src/Zend/zend.c:1852
    #10 0x5591a5df3023 in php_execute_script /home/runner/work/php-src/php-src/main/main.c:2542
    #11 0x5591a694e1b5 in do_cli /home/runner/work/php-src/php-src/sapi/cli/php_cli.c:965
    #12 0x5591a6952128 in main /home/runner/work/php-src/php-src/sapi/cli/php_cli.c:1367
    #13 0x7fba6d6fa082 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x24082)

I was able to reproduce this locally with the following command:

php-dev -d opcache.enable_cli=1 -d opcache.jit=tracing -d opcache.jit_buffer_size=1G -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -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 memory_limit=-1 ./phpunit src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php --exclude-group tty,benchmark,intl-data,transient --exclude-group skip

The leak occurs when running $tester->execute() twice, it's not triggered if only running a single test. However, you can also reproduce it by running --filter testDebugMissingMessages and duplicating that line. Unfortunately, I was not able to build a simple reproducer given that the Symfony code is quite complex. It might be possible to produce one once we understand the root problem.

PHP Version

PHP 8.1+

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions