Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #N
Problem/Motivation
We should only allow the limit to be increased otherwise we don't allow tests or users to increase the time limit to what they want.
// Try to allocate unlimited time to run the tests.
drupal_set_time_limit(0);
run-test2233929s.sh
drupal_set_time_limit($this->timeLimit);
TestBase::prepareEnvironment()
// Try to allocate enough time to run all the hook_cron implementations.
drupal_set_time_limit(240);
cron.php
// Try to allocate enough time to rebuild node grants
drupal_set_time_limit(240);
node.module node_access_rebuild()
---
Causes fails like:
Drupal\config\Tests\ConfigImportAllTest->testInstallUninstall() failing
looked at the test results, in the error log and found:
Fatal error: Maximum execution time of 240 seconds exceeded in /var/lib/drupaltestbot/sites/default/files/checkout/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php on line 542
FATAL Drupal\config\Tests\ConfigImportAllTest: test runner returned a non-zero error code (255).
Proposed resolution
Fix code.
Remaining tasks
Review and agree patch
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#21 | 2233929-drupal-set-time-limit-increase-only-D7.patch | 1.62 KB | Dave Reid |
#15 | drupal-set-time-limit-2233929.15.patch | 478 bytes | Berdir |
#7 | 2233929.7.patch | 1.64 KB | alexpott |
#7 | 5-7-interdiff.txt | 1.17 KB | alexpott |
#6 | 2233929.5.patch | 552 bytes | alexpott |
Comments
Comment #1
alexpottComment #2
alexpottHow about this.
Comment #3
alexpottalexpott is wrong.
http://3v4l.org/i7XsL
Comment #4
alexpottWell now I definitely am wrong lol
Outputs
So actually I think we do have a problem here.
Comment #5
YesCT CreditAttribution: YesCT commenteddocs update for change in #2
Comment #6
alexpottSo given
Let's only allow setting the limit if it is not set to unlimited.
YesCT++ for making me read the docs!
Comment #7
alexpottImproved the docs.
Comment #8
YesCT CreditAttribution: YesCT commentedok. new resolution still allows decreasing the limit.
seems reasonable, docs updated nicely.
Comment #9
YesCT CreditAttribution: YesCT commentedput the fail this fixes in issue summary.
Comment #10
sunLooks good to me as well.
Comment #11
YesCT CreditAttribution: YesCT commentedmaking that test take less time is related.
Comment #12
sunComment #13
webchickCommitted and pushed to 8.x. Thanks!
Comment #15
BerdirLooks like this didn't fix anything after all :)
#2224887: Language configuration overrides should have their own storage was still failing with the 240s timeout (apparently makes it a bit slower) and when debugging, I found out that init_get() returns (string) "0", so the type safe check there fails.
Uploading the interdiff from the languag override issue as a patch...
Comment #16
alexpottConfirmed the vli default is
string(1) "0"
Comment #17
catchCommitted/pushed to 8.x, thanks!
Comment #20
Dave ReidThis is so eligible and needed for Drupal 7 backport.
Comment #21
Dave ReidComment #22
manuelBS CreditAttribution: manuelBS commentedThanks for the patch. I tested it in two projects where I want to set the max execution time of cron runs to unlimited due to big data calculations and this patch helped to get it working. Thanks!
Comment #23
xjmComment #24
fgmActually, this does not accomplish the stated goal : if the max_execution_time is set and nonzero, but higher than the hardcoded limit in Drupal, this will actually reduce the time limit (just had this running D8 tests).
So I think this needs to be changed again in 8.x (then backported) to only be able to increase the limit, hence changing status and resetting to 8.x.However, due to the lack of something like get_time_limit(), there is no apparent way to accomplish the stated goal in that case.Comment #25
fgmResetting to 7.x, and marking RTBC as the patch looks goot to me, and applies on current 7.x HEAD.
Comment #26
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedYeah, I guess this makes sense since pretty much any time any Drupal code uses this it's with the intention of increasing the time limit.
Committed to 7.x - thanks!
Comment #28
Dave ReidComment #30
func0der CreditAttribution: func0der commentedPractially the cause of what I have said here three months earlier, but okay. Take it.