Skip to content
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

Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' #1849

Closed
kimdcottrell opened this issue Apr 30, 2013 · 19 comments
Labels
Milestone

Comments

@kimdcottrell
Copy link

COMMAND RAN AND ERRORS THROWN
[root@s15937355 htdocs]# php composer.phar update laravel/*
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar:///var/www/vhosts/defaul
t/htdocs/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:975
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', 'phar:///var/www...', 975, Array)
#1 phar:///var/www/vhosts/default/htdocs/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(975): proc_open('stty -a | grep

...', Array, NULL, NULL, NULL, Array)
#2 phar:///var/www/vhosts/default/htdocs/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(853): Symfony\Component\Console

\Application->getSttyColumns()
#3 phar:///var/www/vhosts/default/htdocs/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(818): Symfony\Component\Console

\Application->getTerminalDimensions()
#4 phar:///var/www/vhosts/default/htdocs/composer.phar/vendor/symfony/console/Symfony/Component/Console/App in phar:///var/www/vhosts/default/htdocs/co

mposer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php on line 975

COMPOSER.JSON FILE CALLED WHEN UPDATING LARAVEL
{
"name": "laravel/framework",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"require": {
"php": ">=5.3.0",
"classpreloader/classpreloader": "1.0.",
"doctrine/dbal": "2.4.x",
"ircmaxell/password-compat": "1.0.
",
"filp/whoops": "1.0.4",
"monolog/monolog": "1.5.",
"nesbot/carbon": "1.
",
"patchwork/utf8": "1.1.",
"predis/predis": "0.8.
",
"swiftmailer/swiftmailer": "4.3.",
"symfony/browser-kit": "2.3.
",
"symfony/console": "2.3.",
"symfony/css-selector": "2.3.
",
"symfony/debug": "2.3.",
"symfony/dom-crawler": "2.3.
",
"symfony/event-dispatcher": "2.3.",
"symfony/finder": "2.3.
",
"symfony/http-foundation": "2.3.",
"symfony/http-kernel": "2.3.
",
"symfony/process": "2.3.",
"symfony/routing": "2.3.
",
"symfony/translation": "2.3."
},
"replace": {
"illuminate/auth": "self.version",
"illuminate/cache": "self.version",
"illuminate/config": "self.version",
"illuminate/console": "self.version",
"illuminate/container": "self.version",
"illuminate/cookie": "self.version",
"illuminate/database": "self.version",
"illuminate/encryption": "self.version",
"illuminate/events": "self.version",
"illuminate/exception": "self.version",
"illuminate/filesystem": "self.version",
"illuminate/foundation": "self.version",
"illuminate/hashing": "self.version",
"illuminate/http": "self.version",
"illuminate/html": "self.version",
"illuminate/log": "self.version",
"illuminate/mail": "self.version",
"illuminate/pagination": "self.version",
"illuminate/queue": "self.version",
"illuminate/redis": "self.version",
"illuminate/routing": "self.version",
"illuminate/session": "self.version",
"illuminate/support": "self.version",
"illuminate/translation": "self.version",
"illuminate/validation": "self.version",
"illuminate/view": "self.version",
"illuminate/workbench": "self.version"
},
"require-dev": {
"aws/aws-sdk-php": "2.2.
",
"iron-io/iron_mq": "1.4.4",
"pda/pheanstalk": "2.0.",
"mockery/mockery": "0.7.2",
"phpunit/phpunit": "3.7.
"
},
"autoload": {
"classmap": [
["src/Illuminate/Queue/IlluminateQueueClosure.php"]
],
"files": [
"src/Illuminate/Support/helpers.php"
],
"psr-0": {
"Illuminate": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"minimum-stability": "dev"
}

PHP MEMORY LIMIT
[root@s15937355 htdocs]# php -r "echo ini_get('memory_limit').PHP_EOL;"
1024M

FREE MEMORY (in megabytes)
[root@s15937355 htdocs]# free -m
total used free shared buffers cached
Mem: 2048 357 1690 0 0 237
-/+ buffers/cache: 119 1928
Swap: 0 0 0

PHP VERSION
[root@s15937355 htdocs]# php -v
PHP 5.5.0beta4 (cli) (built: Apr 25 2013 15:28:50)

Any ideas?

@kimdcottrell
Copy link
Author

In case anyone is curious, the only workaround for this I've found is to just rename the /vendor/symfony directory by prepending it with a few underscores, run:

php composer.phar update

and then if it goes through, remove the old symfony directory.

@ronanguilloux
Copy link

See Composer's issues #945 & #1101 : Your OS probably runs out of swap memory, this is a common issue on Amazon's ec2. I also encountered it in a local vagrant instance left up too long time, & just needed to reboot to retrieve the minimum 1024Mo RAM required.

@billybigpotatoes
Copy link

Avoid tiny instances on AWS!

@brazorf
Copy link

brazorf commented Sep 17, 2013

Incrementing PHP memory_limit worked fine to me.

@rfanjul
Copy link

rfanjul commented Oct 30, 2013

Try that:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

@htollefsen
Copy link

@rfanjul Thanks!

@sinner
Copy link

sinner commented Nov 18, 2013

@rfanjul Thank you very much!

@fredriktid
Copy link

@rfanjul Did the trick, thanks!

@jeffersonsouza
Copy link

This code save life! Thanks!

@fundup
Copy link

fundup commented Dec 31, 2013

Put memory_limit to 256M works for me

@deletosh
Copy link

@rfanjul thou rock!

@sndpl
Copy link

sndpl commented Feb 20, 2014

@kimdcottrell did you try the solution of @rfanjul ? if it worked, can you close this issue?

@tan-c
Copy link

tan-c commented Feb 24, 2014

@rfanjul works like a charm

sndpl pushed a commit to sndpl/composer that referenced this issue Feb 24, 2014
…rs that happen on a tiny VPS with no swap space. Also added the solution provided in composer#1849, composer#1101, composer#945.
@Seldaek Seldaek closed this as completed Feb 24, 2014
@rleger
Copy link

rleger commented Aug 25, 2014

Thanks!!

@jrean
Copy link

jrean commented Oct 2, 2014

@rfanjul Thanks!

2 similar comments
@dmitriynet
Copy link

@rfanjul Thanks!

@blue7wings
Copy link

@rfanjul Thanks!

@ozgursoy
Copy link

@rfanjul Thanks a lot, it works

@cakpep
Copy link

cakpep commented Dec 20, 2016

@rfanjul its cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests