-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement Limiting Max Child Processes Via an Exec Env Var API #69
base: 4.x
Are you sure you want to change the base?
Conversation
rhift
commented
May 7, 2019
- create Memory singleton
- move canEnvironmentSustainAdditionProcesses to Strategy
- use Memory singleton in canEnvironmentSustainAdditionProcesses
- DI YAML trailing newlines <3 mucha
- add public access modifier to some constants in StrategyInterface
- trailing newline in StrategyInterface <3 mucha
- add apply memory limit using Memory singleton in Job Process class
- import Throwable in Job Process class
- inject Memory singleton into Job Process class
- remove canEnvironmentSustainAdditionProcesses from ProcessInterface
- add trailing newline to ProcessInterface <3 mucha
* create Memory singleton * move canEnvironmentSustainAdditionProcesses to Strategy * use Memory singleton in canEnvironmentSustainAdditionProcesses * DI YAML trailing newlines <3 mucha * add public access modifier to some constants in StrategyInterface * trailing newline in StrategyInterface <3 mucha * add apply memory limit using Memory singleton in Job Process class * import Throwable in Job Process class * inject Memory singleton into Job Process class * remove canEnvironmentSustainAdditionProcesses from ProcessInterface * add trailing newline to ProcessInterface <3 mucha
case self::Mebibyte: | ||
$Value *= 1024; | ||
case self::Kibibyte: | ||
$Value *= 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have a default exceptional case here.
@@ -56,6 +59,41 @@ public function setAlarmProcessTypeCode(string $alarmProcessTypeCode): StrategyI | |||
return $this; | |||
} | |||
|
|||
public function canEnvironmentSustainAdditionalProcesses(): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be executed for each Strategy (Server, Root, Job, etc). That behavior should be benign, but it's not correct. I need to have the memory condition be specific to a strategy. I'll fix it but it shouldn't have bearing on public behavior.
{ | ||
$processMaximumMemoryValue = $this->getEnvironmentMemory()->getWorkerMaximumMemoryValue(); | ||
$this->_getLogger()->debug(sprintf('Applying memory limit of [%s] bytes.', $processMaximumMemoryValue)); | ||
ini_set('memory_limit', $processMaximumMemoryValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that PHP will set memory_limit
to be 2MiB if it is set to any smaller value. 2MiB is the smallest PHP allows.
@@ -0,0 +1,15 @@ | |||
parameters: | |||
Neighborhoods\Kojo\Environment\MemoryInterface.EnvironmentMaximumMemoryInputValue: '%env(ENVIRONMENT_MAXIMUM_MEMORY_INPUT_VALUE)%' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows missing values since this will be a 4.x release.
Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\EnvNotFoundException: Environment variable not found: "ENVIRONMENT_MAXIMUM_MEMORY_INPUT_VALUE". in /var/www/html/kojo_fitness.neighborhoods.com/UseCase46/vendor/symfony/dependency-injection/EnvVarProcessor.php on line 131