Output console error when terminating due to memory usage #1391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #463 the memory limit was made configurable, however, when the memory limit is set too low (e.g. in my case more memory was being used than the default 64MB), Horizon will just fail silently.
For months Horizon was "broken" in one of my projects and I couldn't figure out why. No console output, no log output. The same is the case for #375.
This PR adds clear console output when
php artisan horizon
terminates due to using more memory than configured (or the default 64MB)Before this PR:
![image](https://private-user-images.githubusercontent.com/9074391/306222273-ee6a1de1-e5c6-4387-85f2-fe2868e4a461.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDI0NDksIm5iZiI6MTcyNjEwMjE0OSwicGF0aCI6Ii85MDc0MzkxLzMwNjIyMjI3My1lZTZhMWRlMS1lNWM2LTQzODctODVmMi1mZTI4NjhlNGE0NjEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTJUMDA0OTA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzE0ZDBlNDBhOGM1MjBhZGNkMDQ5ZmY0NTJlOTJkZDVjYWIwZGMxMTZiYjM2YTE0ZTU2MmEwMGQzNWU3MDU1OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.I8woZDXc1hhwZowZCr0cHiNYITAkQOZXehf0KdJqdW8)
After this PR:
![image](https://private-user-images.githubusercontent.com/9074391/306222524-679082cd-3cd2-492c-bb27-a19ee251d5ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDI0NDksIm5iZiI6MTcyNjEwMjE0OSwicGF0aCI6Ii85MDc0MzkxLzMwNjIyMjUyNC02NzkwODJjZC0zY2QyLTQ5MmMtYmIyNy1hMTllZTI1MWQ1YWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MTJUMDA0OTA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTU0MmY1ODIwNTAyNDY0OGE1NGRiMWVkMDI0YTYzMDg2MDUwNWNkMDE1NjBlZDRhYzFjZDkyZmJlMGE0N2FlZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._xkr-4YIAG10640e-HTALREazmtVnf4dnP6Ozc-OxmU)
I first just added the output without the change in
src/Console/HorizonCommand.php
, that is still an option.The output is then: