Automattic / Automattic/wp-super-cache
Super Cache hanging until max execution time during garbage collection
- Dominant language
- PHP
- Stars
- 436
- Forks
- 130
- Avg merge
- 15h 11m
- Merged PRs (30d)
- 10
Description
### Impacted plugin
Super Cache
### Quick summary
I have noticed some critical errors in my PHP logs that seem to be related to WP Super Cache. The log entries look like this:
```
Maximum execution time of 30 seconds exceeded
{
"error": {
"type": 1,
"file": "/srv/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php",
"line": 2673
},
"remote-logging": true,
"backtrace": [
{
"file": "/srv/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php",
"line": 413,
"function": "critical",
"class": "WC_Logger",
"type": "->"
},
{
"function": "log_errors",
"class": "WooCommerce",
"type": "->"
}
]
}
```
The woocommerce file is just the one that is capturing the log message. I looked at [line 2673](https://github.com/Automattic/jetpack/blob/d2c7b02f9ccf51c7390e0aa36ae1f520377c2108/projects/plugins/super-cache/wp-cache-phase2.php#L2673) and that appears to be calling `is_dir()`. I'm not sure how that could be hanging for 30 seconds, but that appears to be what's going on.
This error is happening intermittently, but regularly according to the logs. It looks like it happened once every 4 hours yesterday. Interestingly, I have the Garbage Collection set to run on a schedule every 14400 seconds (4 hours).
Possibly relevant environment info:
WP Super Cache version: 2.0.0
PHP version: 8.1.31
Server: Apache
### Steps to reproduce
I'm not sure.
### Site owner impact
Fewer than 20% of the total website/platform users
### Severity
Minor
### What other impact(s) does this issue have?
No revenue impact
### If a workaround is available, please outline it here.
_No response_
### Platform (Simple and/or Atomic)
Self-hosted
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at wp-cache-phase2.php line 2673 and trace the scheduled garbage-collection path around the is_dir() call. Review the PHP 8.1.31 and Apache context, noting that the report has no reliable reproduction steps. Done means garbage collection no longer intermittently reaches the 30-second maximum execution time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, php
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100