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

mmap() failed: [12] Cannot allocate memory when running check cache-flush #178

Closed
2 tasks done
jordantrizz opened this issue Mar 14, 2023 · 3 comments
Closed
2 tasks done
Milestone

Comments

@jordantrizz
Copy link

jordantrizz commented Mar 14, 2023

Bug Report

Describe the current, buggy behavior

The check "cache-flush" has issues when the wp-content folder has many files, the site that was affected had 40,000 files in the wp-content directory.

Describe how other contributors can replicate this bug

Run wp doctor check cache-flush

Describe what you would expect as the correct outcome

Only scan .php or rebuild the function so that it doesn't exceed memory limits.

Let us know what environment you are running this on

❯ wp cli info
OS:     Linux 4.15.0-134-generic #138-Ubuntu SMP Fri Jan 15 10:52:18 UTC 2021 x86_64
Shell:  /usr/bin/zsh
PHP binary:     /usr/local/lsws/lsphp74/bin/php
PHP version:    7.4.33
php.ini used:   /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 14.14 Distrib 5.7.41, for Linux (x86_64) using  EditLine wrapper
SQL modes:      ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/dev/public_html/wp-content/uploads
WP-CLI packages dir:    /root/.wp-cli/packages/
WP-CLI cache dir:       /root/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.7.1
@danielbachhuber
Copy link
Member

Thanks for the report, @jordantrizz !

Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices, if it's helpful.

@jordantrizz
Copy link
Author

I would love to address this, but time is an issue, and I'm still mediocre at programming at best. So I'd have to take some time to figure out how best to implement the change.

xknown added a commit to xknown/doctor-command that referenced this issue Nov 16, 2023
We currently scan all the PHP files in the target WP content dir looking
for `wp_cache_flush()` uses, however we are not currently using the
results in a meaninful way so we can just probably return early if the
current check found a match.

If there are plans to list the matched files, we can probably attempt to
use some more performan alternatives (grep if available for example)
which should be likely faster than a PHP based implementation.

See wp-cli#178
@danielbachhuber danielbachhuber added this to the 2.2.0 milestone Nov 18, 2023
@danielbachhuber
Copy link
Member

🔨

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

No branches or pull requests

2 participants