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

noabort and noconntimeout don't seem to work for wp-cron #428

Open
nickchomey opened this issue Dec 1, 2024 · 8 comments
Open

noabort and noconntimeout don't seem to work for wp-cron #428

nickchomey opened this issue Dec 1, 2024 · 8 comments

Comments

@nickchomey
Copy link

Hi there, i have this at the very top of my site's .htaccess file, but it doesnt seem to be overriding env LSAPI_MAX_PROCESS_TIME=#

<IfModule Litespeed> 
  RewriteEngine On
  RewriteRule (wp-cron|backupbuddy|importbuddy)\.php - [E=noabort:1, E=noconntimeout:1]
</IfModule>

Nor does it work if I swap the RewriteRule with SetEnvIf Request_URI "(wp-cron|backupbuddy|importbuddy)\.php" noabort noconntimeout

Why might this be? The troubleshooting on this page says this should work.
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:run-without-timeouts#troubleshooting

Does it only work for litespeed enterprise?

@nickchomey
Copy link
Author

I see that there's apparently already noabort mechanism specifically for wp-cron here. But it doesnt seem to do anything. Perhaps it needs to be noconntimeout instead?

@nickchomey
Copy link
Author

I now see these in the error log

2024-12-01 22:45:39.448661 [INFO] [41258] Rewrite directive: <IfModule Litespeed>  bypassed.
2024-12-01 22:45:39.448665 [INFO] [41258] Invalid rewrite directive: SetEnvIf Request_URI "(wp-cron|backupbuddy|importbuddy|inf)\.php" noabort noconntimeout
2024-12-01 22:45:39.448667 [INFO] [41258] Rewrite directive: </IfModule> bypassed.

Same if I use SetEnv. So, i guess those are only LSE.
But even if I just put the rewrite outside of the <IfModule Litespeed> tag, it still doesnt work

@litespeedtech
Copy link
Owner

LSAPI_MAX_PROCESS_TIME cannot be overridden with request environments.
It is used by the watchdog (parent) process of a worker group, must be set during process startup.

@nickchomey
Copy link
Author

Thank you for the clarification.

Though, what is noconntimeout for then, if you cant override lsapi_max_process_time?

@Code-Egg
Copy link
Contributor

Code-Egg commented Dec 3, 2024

I guess noconntimeout can override max_execution_time maybe?

@nickchomey
Copy link
Author

Perhaps. I'll try to test that out soon. But if that's the case, I don't understand the point of LSAPI_MAX_PROCESS_TIME. Why not just use php max_execution_time?

@litespeedtech
Copy link
Owner

max_execution_time only count actual CPU usage time, if you have a worker block on network I/O, it will wait forever. never reach max_execution_time. LSAPI_MAX_PROCESS_TIME is another safe guard, count the time from the request start being processed.

@nickchomey
Copy link
Author

Ah, gotcha. Yes that makes sense, and I use LSAPI_MAX_PROCESS_TIME precisely for handling the network blocking.

The issue I'm trying to solve for, in particular, is wp-cron.

I've found that triggering it via "wp cron event run" is not as reliable. Likewise, triggering php cli "php /path/to/wp-cron.php" is not always reliable because some plugins rely on http headers sometimes.

So I want to trigger via web request (eg wget site.com/wp-cron.php). But I'd rather have a short LSAPI_MAX_PROCESS_TIME for normal web requests (eg 10 seconds) in order to protect against stuck external requests, and a long (many minutes, or even infinite) time for wp-cron.

If I can't use RewriteRule (wp-cron|backupbuddy|importbuddy).php - [E=noabort:1, E=noconntimeout:1 to override LSAPI_MAX_PROCESS_TIME, then I don't know how I can solve for this.

Sure, I could have some wp hook to perhaps dynamically set max_execution_time for wp-cron requests, but that would get overriden by the short LSAPI_MAX_PROCESS_TIME.

Any thoughts on how I can solve this?

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

3 participants