herd-community
herd-community copied to clipboard
Timeout after 10 seconds even though php settings are set to 30 seconds [Bug]:
Platform
macOS
Operating system version
macOS Sonoma 14.4.1
System architecture
ARM64 (M1, M2, etc)
Herd Version
1.6.0 Build: 24
PHP Version
8.1.26
Bug description
When working on a site that has to send requests to a slow MS Dynamics site I am getting a timeout while the request is in progress.
The error message is Maximum execution time of 30 seconds exceeded but I have timed it and it times out at 10 seconds every time.
This was working fine on valet so I'm unsure what the issue is.
Flare stack trace attached is here -> https://flareapp.io/share/dPbarwXm
Steps to reproduce
Default installation of Laravel Herd. Run a long running cURL request that exceeds 10 seconds.
Relevant log output
php.ini max_execution_time = 30
Do you see the correct max_execution_time when you run phpinfo(); in a route?
i can confirm this. i have same hardware, using php 8.2 changed the php.ini for php 8.2 and added below config
max_execution_time=180
max_input_time=180
memory_limit=256M
post_max_size=20M
upload_max_filesize=20M
when i check using phpinfo(); values as below
max_execution_time=30
max_input_time=-1
memory_limit=128M
post_max_size=8M
upload_max_filesize=2M
I have tried herd restart etc but changes are not applied.
I am having the same problem. When I adjust the memory_limit setting via the UI to -1 I see that it is adjusted in the php.ini file. Through popinfo(); I see the default unadjusted values in the browser. So it is not being implemented.
This applies to the CLI version. I have to run this for example like: herd php -d memory_limit=-1 ./vendor/bin/drush cr.
@mpociot Sorry its taken so long to get back.
Inside a controller function I have logged out the phpinfo. It is showing the correct value, I updated this to 60 seconds to test. phpinfo() shows 60 seconds but it still times out after 10 seconds with the message Maximum execution time of 60 seconds exceeded
Screenshot attached
I can confirm this. It's been there quite some time. Hopefully someone could pinpoint this. I'm subscribing to the thread...
I am having the same issue that @metadeck reported at the beginning.
Here, you can see the request returning the max execution error and the time shown by the dev tools.
Anyone had a solution?
Nothing yet. I've combed through all the php config files and cannot find any references to 10 seconds. The weird thing is that it errors with the correct timeout value but always after 10 seconds.
@mpociot is there anything in the Herd core than manually fires a timeout?
This is really odd. Can you simply reproduce this by adding a sleep(15) to your code?
Now it's even more weird:
Herd 1.6.1:
<?php
print('max_execution_time: ' . ini_get('max_execution_time') . PHP_EOL);
$seconds = 59;
sleep($seconds);
echo 'Done after '.$seconds.' seconds';
exit;
Results in: max_execution_time: 30 Done after 59 seconds
with $seconds set to 60 the page does time out with the 504 Gateway Time-out nginx failure.
This is my phpinfo:
Then only thing in the
phpinfo which is set to 60 is the default_socket_timeout. Don't know if that has to do something with it?
I'm facing the same problem. But weirder!
php -i | grep max_execution_time max_execution_time => 0 => 0
@mpociot I've added in a sleep call of 20 seconds on my home page and my site loads no problem after the sleep function returns. It looks like the duration of sleep is ignored by max_execution_time. https://www.php.net/manual/en/function.set-time-limit.php#72167
I also encountered this issue. I searched through all discussions, but couldn't solve it. So, I reduced the number of sites, and the problem disappeared. I hope this helps others think through the issue.
Can someone provide a piece of code where I can successfully reproduce this? I'm unable to force this error with sleep I'm afraid
My hardware is a Mac Mini M1, and the Laravel version is 11.
Recently, I've been frequently encountering timeout errors with approximately an 80% chance. As a result, I have to look for a solution, even for the simplest "hello world" output.
Is there a way for you to always reproduce this?
This happens sporadically for me as well, it seems to happen on a large Statamic site I have, but I'm not sure exactly what is causing this exactly to reproduce it.
Here is a flare of the error when its thrown: https://flareapp.io/share/W7zaoKbP
I have also experienced this issue, it doesn't happen often, but enough to be quite frustrating.
It mainly happens when running npm run dev in my Laravel app and having multiple windows open with the same application if that's of any help?
It always dies on a redis or database connection.
This also happens for me every now and then, timeout after <30s with the default timeout of 30s
@mpociot this thread may be of interest to you. Looks like a fix was merged for 8.1, 8.2, 8.3 not too long ago.
https://github.com/php/php-src/issues/12814
Ohhh interesting! So this should be fixed when you update PHP 8.2 and 8.3 I'll add this patch to 8.1 as well (as this one is no longer maintained)
I am running PHP 8.3.8, which PHP 8.3 version should have the patch?
Although it was merged in I don't see it in the release notes
I've downloaded the latest Herd (1.7.1) along with updating all PHP versions (using php 8.3.8) but still facing the same timeout issue.
Has anyone been able to run this successfully after updating PHP?
I was getting Maximum execution time of 30 seconds exceeded today after about 2 seconds.
PHP Version: 8.3.8
Herd: 1.7.1 (38) Mac
Switching PHP Version of the Site down to 8.2 fixed it. After Switching back to Version 8.3.8 is still worked.
https://github.com/php/php-src/pull/13567#issuecomment-2191949833
According to this it's been patched in 8.3.9 and 8.2.21 - currently release candidates so it may not have made it through to the Herd PHP versions yet.
@mpociot does this need reopening until it's fixed or tagging in another way as it's still an open issue.
My workaround at the minute is adding this to any long running functions or set at a more global level.
// set the max execution time if we are on local environment
if (app()->environment('local')) {
ini_set('max_execution_time', 300);
}
It's not ideal but patches the issue.
8.3.9 is now out, i've had the issue after updating but then restarted Herd and been ok since.
Also fail on my local environment, solution provided by @metadeck works. Thanks
@mpociot I don't think this is fixed, I'm on PHP 8.3.12 and on Herd 1.11.0 and I set max_execution_time=180 in php.ini of herd php83 but no effect even after restarting services