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

zend_mm_heap corrupted #337

Open
mvorisek opened this issue Dec 15, 2024 · 3 comments
Open

zend_mm_heap corrupted #337

mvorisek opened this issue Dec 15, 2024 · 3 comments
Assignees

Comments

@mvorisek
Copy link

repro branch: https://github.com/php-lock/lock/tree/test_37

steps to reproduce:

  1. clone the repo
  2. run composer update
  3. run php vendor/bin/phpunit --no-coverage
Runtime:       PHP 8.3.14
Configuration: /__w/lock/lock/phpunit.xml.dist

...............................................................  63 / 169 ( 37%)
...............1 Running 
zend_mm_heap corrupted
2 Running 
3 Running 
Aborted (core dumped)
@mvorisek
Copy link
Author

On PHP 7.4 and 8.0 I get:

1) Malkusch\Lock\Tests\Mutex\FlockMutexTest::testThreadLock
Error: Using $this when not in object context

/__w/lock/lock/tests/Mutex/FlockMutexTest.php:123

which points to https://github.com/php-lock/lock/blob/7075016e8b44fe7d2e61bab913d56d5ca79fec51/tests/Mutex/FlockMutexTest.php#L123.

It seems there is some refcounting issue.

@realFlowControl realFlowControl self-assigned this Dec 17, 2024
@realFlowControl
Copy link
Collaborator

Hey @mvorisek 👋

thanks for raising this issue! I might have limited time over the next few weeks, so do not expect any updates on this.

There are some things you could do to help me narrow the problem down:

  • try running with different PHP versions (8.0 to 8.4)
  • try with and without OPcache (make sure OPcache on CLI is enabled)
  • try with older versions of parallel (v1.2.4 vs. v1.2.5)
  • provide a backtrace without ZendMM:
    $ USE_ZEND_ALLOC=0 gdb --args php vendor/bin/phpunit --no-coverage
    Once it fails, type bt to get a backtrace and post that here.

This might help a bit, but I am not sure. I might need to run this with ASAN to get to the root cause.

@mvorisek
Copy link
Author

Not sure if a backtrace would help here, as the variable used in the Closure is released too early, it seems the Closure passed to \parallel\run somehow does not hold the references until all parallel tasks are executed.

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

No branches or pull requests

2 participants