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

var_export does not handle circular references #3638

Closed
dereuromark opened this issue Jul 20, 2020 · 10 comments
Closed

var_export does not handle circular references #3638

dereuromark opened this issue Jul 20, 2020 · 10 comments

Comments

@dereuromark
Copy link
Contributor

dereuromark commented Jul 20, 2020

Bug report

latest 0.12.33

Warning: var_export does not handle circular references in
phar:///home/travis/build/.../vendor/phpstan/phpstan/p
hpstan/src/Cache/FileCacheStorage.php on line 70

Travis CI reports
php --version

PHP 7.4.2 (cli) (built: Jan 24 2020 13:44:53) ( ZTS )

@mergeable
Copy link

mergeable bot commented Jul 20, 2020

This bug report is missing a link to reproduction on phpstan.org.
It will most likely be closed after manual review.

@dereuromark
Copy link
Contributor Author

This might also be related fatal errors we experience in Travis CI, memory related:

mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 3284664320) (tried to allocate 3080720384 bytes) in phar:///home/travis/build/.../vendor/phpstan/phpstan/phpstan/src/Cache/FileCacheStorage.php on line 70
Fatal error: Out of memory (allocated 3284664320) (tried to allocate 3080720384 bytes) in phar:///home/travis/build/.../vendor/phpstan/phpstan/phpstan/src/Cache/FileCacheStorage.php on line 70

@ondrejmirtes
Copy link
Member

I never saw this error, I tried adding some debugging code: phpstan/phpstan-src@542238a

Can you run dev-master of phpstan/phpstan (please wait 15 minutes so the PHAR gets built) and report what error message you get? Thanks.

@dereuromark
Copy link
Contributor Author

dev-master seems to not output the var_export warnings anymore, but the memory leak seems to persist still

mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory

note: we have been using 0.12.27 so far without issues, now with upgrading we experience these.
So something from 0.12.28...0.12.32 seems to cause these. I could slowly upgrade the patches to see if I can narrow it down more.

It seems to only happen to parts of the system, a few classes, so something with those must trigger this huge memory allocation issue. But with local system not reproducing this, it is hard to find this only in Travis CI.
We also tried to use 7.3 instead of 7.4 (same thing).

Also note:
Performance also went down here (but probably is not related directly):

  • 0.12.27: 983s
  • dev-master (~0.12.33): 1793s

@ondrejmirtes
Copy link
Member

I have no idea what's wrong or what's causing this problem :) The big change was between 0.12.25 and 0.12.26 (and that's expected to consume a bit more memory/be slower), but after that I'm not sure. If you could somehow bisect the problem it would be nice.

@dereuromark
Copy link
Contributor Author

You are right, the latest builds that didnt fail are using 0.12.25 so the changes of 0.12.26+ did introduce what is now still there in 0.12.33+

@ondrejmirtes
Copy link
Member

What memory limit you currently have? You can set a higher one just for PHPStan with: https://phpstan.org/user-guide/command-line-usage#--memory-limit

@dereuromark
Copy link
Contributor Author

dereuromark commented Jul 23, 2020

No limit other than what travis gives us ( 3284664320 = 3GB it seems) in bionic distro.
We inject

memory_limit = -1

@ondrejmirtes
Copy link
Member

There's no way for me to fix this - I need a reproduction. Can you try running PHPStan with --debug to see which file it analyzes before it throws this error?

@github-actions
Copy link

github-actions bot commented May 7, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants