Composer runs out of Memory after upgrading to 8.5.6

General discussion on Zend Server for IBM System i

Composer runs out of Memory after upgrading to 8.5.6

Postby dan8246 on Thu Dec 01, 2016 11:19 pm

I haven't had to use Composer in a few weeks, so it's possible this isn't related to upgrading to Zend Server 8.5.6. I just happened to notice this the day after upgrading to 8.5.6. In short, when I try to update or install new packages I get an out of memory error. Has anyone experienced this issue after upgrading to 8.5.6? Or at all for that matter and can suggest some things to look into? There are a slew of similar questions as this, but they all just suggest increasing the "memory_limit" directive is the solution (which at 2Gb isn't for me). There was just one solution which strays from that and it involved editing the php-cli file. While it was a bit dated and seemed like a hack I gave it a shot and still no luck. Here is a link to that solution: http://forums.zend.com/viewtopic.php?f=77&t=8404

All I'm trying to do is add a package to an existing application:
Code: Select all
composer require phpoffice/phpexcel


But I keep getting an out of memory error (the exact file and line number seems to vary):
Code: Select all
Fatal error: Out of memory (allocated 51380224) (tried to allocate 3610193 bytes) in phar:///QOpenSys/usr/bin/composer/src/Composer/Json/JsonFile.php on line 266


I experience the same issue even if I just try to run
Code: Select all
composer update


I have the composer phar located at: /usr/local/bin/composer (no '.phar' extension). Composer is at the most current version (1.2.3) and updates fine with:
Code: Select all
composer self-update


I have also tried increasing the "memory_limit" directive to as much as 2G (as suggested for many other similar questions on various sites) to see if it made a difference, but still no luck.

It doesn't even report any errors when I run:
Code: Select all
composer diagnose -vvv


I understand the act of installing/updating packages using composer can be very memory intensive, but I don't see how it should exceed 2Gb. Additionally, the amount of memory the error message reports as "allocated" and "attempted to allocate" comes nowhere near 2Gb combined. However, one thing about the output below which makes me curious is how it is trying to pull in packagist files into the cache for various years. I don't recall ever seeing that, but I may have just always missed it.

Here is the output of an attempt of adding the new package using the -vvv switch. After, I also included the value of the "memory_limit" directive for both php and php-cli:
Code: Select all
bash-4.3$ composer require phpoffice/phpexcel -vvv
Reading ./composer.json
Loading config file /home/DL/.composer/config.json
Loading config file /home/DL/.composer/auth.json
Loading config file ./composer.json
Checked CA file /tmp/composer-cacert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem: valid
Executing command (/www/zendsvr6/htdocs): git branch --no-color --no-abbrev -v
Executing command (/www/zendsvr6/htdocs): git describe --exact-match --tags
Executing command (/www/zendsvr6/htdocs): git log --pretty="%H" -n1 HEAD
Reading /home/DL/.composer/composer.json
Loading config file /home/DL/.composer/config.json
Loading config file /home/DL/.composer/auth.json
Loading config file /home/DL/.composer/composer.json
Loading config file /home/DL/.composer/auth.json
Reading /home/DL/.composer/auth.json
Reading /www/zendsvr6/htdocs/vendor/composer/installed.json
Running 1.2.3 (2016-12-01 14:33:53) with PHP 5.6.28 on OS400 / 2
Downloading https://www.setasign.com/downloads/packages.json
Writing /home/DL/.composer/cache/repo/https---www.setasign.com-downloads/packages.json into cache
Downloading https://www.setasign.com/downloads/packages.json
Writing /home/DL/.composer/cache/repo/https---www.setasign.com-downloads/packages.json into cache
Downloading https://packagist.org/packages.json
Writing /home/DL/.composer/cache/repo/https---packagist.org/packages.json into cache
Reading /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
Downloading http://packagist.org/p/provider-2015%245afe9fe65dca842238f4a8c3d3dedcc6eda932a18935a5008c305ef0184da9f2.json
Writing /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2015.json into cache
Reading /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json from cache
Reading /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2016-04.json from cache
Reading /home/DL/.composer/cache/repo/https---packagist.org/p-provider-2016-07.json from cache
Downloading http://packagist.org/p/provider-2016-10%24e85a2e181eab24bd2ca71cba8e470fab52f24bc250f436ee7634f10d96e4012c.json

Fatal error: Out of memory (allocated 51380224) (tried to allocate 3610193 bytes) in phar:///QOpenSys/usr/bin/composer/src/Composer/Json/JsonFile.php on line 266
bash-4.3$ php -r "phpinfo();" | grep memory_limit
memory_limit => 2G => 2G
bash-4.3$ php-cli -r "phpinfo();" | grep memory_limit
memory_limit => 2G => 2G
dan8246
 
Posts: 35
Joined: Fri Jan 23, 2015 5:53 pm

Re: Composer runs out of Memory after upgrading to 8.5.6

Postby zvika on Sun Dec 11, 2016 2:50 pm

You are getting out of memory error (machine out of memory), not allowed memory exhausted, which refers directly to PHP memory_limit.
Free machine memory by closing some apps, especially browser windows, and try again.
Zvika Dror
Zend Support Team
User avatar
zvika
Zend Global Support
 
Posts: 966
Joined: Sun Dec 14, 2008 9:48 am

Re: Composer runs out of Memory after upgrading to 8.5.6

Postby dan8246 on Mon Dec 12, 2016 3:22 pm

Interesting, I'm running these commands directly on the i via a Putty SSH terminal (so no browsers to close). Further, when I watch the memory usage using WRKSYSSTS while running the composer command, none of my memory pools even come close to their maximum limit. However, from what you're saying this is more of an IBM i question than a Zend PHP question. I believe we have also applied some PTFs since I last remember this working (one of which dealt with OpenSSL), so I'll venture down that path to see what I find.

Much appreciation
dan8246
 
Posts: 35
Joined: Fri Jan 23, 2015 5:53 pm


Return to Zend Server for IBM i

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests