How can i fix it ?
When i command composer update . there is an error "mysqld invoked oom-killer:" and so on. how to fix it or what i need to do to fix it . Thank you
8 Replies
The “oom-killer” is the “out of memory killer” - when the system is so starved of memory, it tries to find processes it can kill to get more back.
Composer is very memory hungry, especially if you have a large dependency tree. I’ve had instances where it has needed >1GB RAM.
My suggestions would be to make sure you’ve got the latest version of Composer and of PHP for the minor version you’re on (7.0, 7.1, 7.2 etc.)
Otherwise, you could fetch your files to your local laptop, run composer update on there. Then upload the composer.lock back to your server and run “composer install”.
If none of that works for you, try scaling your Linode plan up to get more memory (do not select to upgrade the disk space), run your update command, and scale it back down again.
Hello sir. Thank you sir. I just want to ask because we subscribed in 1GB Ram Only . do you think when we upgrade it to 2GB it makes work? Thank you
@Jerome --
With all due respect, it's going to be impossible for any of us to answer that question without more information. Posting your composer.json file would help immensely.
-- sw
Hello sir. This is the composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"doctrine/dbal": "^2.10",
"elibyy/tcpdf-laravel": "^8.0",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/socialite": "^4.3",
"laravel/tinker": "^2.0",
"lcobucci/jwt": "3.3.1",
"paypal/rest-api-sdk-php": "*",
"smalot/pdfparser": "^0.16.2",
"stripe/stripe-php": "^7.76",
"tymon/jwt-auth": "^1.0"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"laravel/ui": "^1.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
Thank you sir
i get this error "mysqld invoked oom-killer:" when i install stripe and paypal. Thank you so much
i get this error "mysqld invoked oom-killer:" when i install stripe and paypal. Thank you so much
So…composer does not use mysql(1) at all. I think you have another issue here. Do you have a WP site running on your nanode?
I ran your composer.json on my 2Gb ARM single-board computer that runs Debian and it ran just fine. It failed but for reasons not at all related to memory pressure. It generated a 93Mb vendor directory and a 280K composer.lock file.
What I would do is split your site does somehow (you have to decide that) and move your website to a bigger Linode. Then see how things go after that.
I have to reiterate, IMHO, your memory problem is not related to composer.
-- sw
when i try this command sir. composer require "paypal/rest-api-sdk-php:*"
Out of memory: Kill process 6972(php) score 675 or sacrifice child.
Killed process 6972(php) total-vm:1212720kb, anon-rss:871808kb, file-rss:0kb; shmem-rss:0kb
oom_reaper: reaped process 6972(php), now anon-rss:0kb, file-rss:0kb, shmem-rss:0kb Killed.
That is the error sir. Thank you :)
I have to reiterate, IMHO, your memory problem is not related to composer.
I've seen Composer use upwards of 1GB memory during an update operation, with Laravel as well like @Jerome is using.
The "correct" workflow for Composer is to run the update operation on your development environment, so your local computer - which would hopefully have much more than 1GB RAM.
Commit the composer.lock
file to source control (or copy it up to your Linode) and then run composer install
which is much less intensive as it's just fetching and installing already-determined packages.
do you think when we upgrade it to 2GB it makes work?
I can't say. All you can do is try it. Just make sure not to select the option to auto-increase disk space, and you'll be able to scale your Linode back down once you've finished the update.