Chefspec Errno::ENOMEM


#1

On a handful of recipes, we’re getting the following errors and cannot seem to avoid them. The pattern appears to be with any Mixlib::ShellOut commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} | grep MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


#2

Curtis

It looks like your server is maxed out of free memory. It can no longer allocate new memory to new processes.
You’ll have to upgrade your server memory or find out what’s taking up all of the memory and do something about that.

Kind regards,
Steven

On 11 Feb 2014, at 16:58, Stewart, Curtis cstewart@momentumsi.com wrote:

On a handful of recipes, we’re getting the following errors and cannot seem to avoid them. The pattern appears to be with any Mixlib::ShellOut commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} | grep MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


#3

Thanks Steven.

It appears that rspec/chefspec is taking up all my memory. If anyone is aware of similar issues and found better versions to work with, could you list your environment?

Near the beginning of my tests, only ~ 20% of my memory if being allocated to rspec. Near the end (about 14 min later), nearly 65% is used (top output below).

top output:
28985 jenkins 20 0 1438m 1.3g 5196 R 100 65.1 14:35.13 ruby

Here’s my current environment:

  • chefspec (3.1.4)
  • rspec (2.14.1)
  • rspec-core (2.14.7)
  • rspec-expectations (2.14.5)
  • rspec-mocks (2.14.5)

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
rvm 1.25.17 (stable)

Thanks,
Curtis

On Feb 11, 2014, at 10:16 AM, Steven De Coeyer <steven@banteng.bemailto:steven@banteng.be> wrote:

Curtis

It looks like your server is maxed out of free memory. It can no longer allocate new memory to new processes.
You’ll have to upgrade your server memory or find out what’s taking up all of the memory and do something about that.

Kind regards,
Steven

On 11 Feb 2014, at 16:58, Stewart, Curtis <cstewart@momentumsi.commailto:cstewart@momentumsi.com> wrote:

On a handful of recipes, we’re getting the following errors and cannot seem to avoid them. The pattern appears to be with any Mixlib::ShellOut commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} | grep MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


#4

Only thing I can think of is this:

https://tickets.opscode.com/browse/CHEF-4794

  • Julian

On Tue, Feb 11, 2014 at 4:58 PM, Stewart, Curtis
cstewart@momentumsi.com wrote:

On a handful of recipes, we’re getting the following errors and cannot seem
to avoid them. The pattern appears to be with any Mixlib::ShellOut
commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} | grep
MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#5

Hi Curtis,
out of curiosity , any reason you dont want to use the aws-sdk’s ruby api
directly to enlist and get all the objects md5? wont it be much cleaner?

On the shellout error, this will be problematic if large number of files
are in the bucket, as you are parsing the entire stdout content,

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html

On Tue, Feb 11, 2014 at 1:10 PM, Julian C. Dunn jdunn@aquezada.com wrote:

Only thing I can think of is this:

https://tickets.opscode.com/browse/CHEF-4794

  • Julian

On Tue, Feb 11, 2014 at 4:58 PM, Stewart, Curtis
cstewart@momentumsi.com wrote:

On a handful of recipes, we’re getting the following errors and cannot
seem
to avoid them. The pattern appears to be with any Mixlib::ShellOut
commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins
server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} |
grep
MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#6

Thanks for the responses Julian and Ranjib.

I’ll see if the 11.10 version of chef would resolve some issues.

And I haven’t considered using the ruby api directly, we install s3cmd with our baseos on all machines and I thought using it would be the best option.

I’ll look into a library that uses a pi’s.

Thanks again,
Curtis

On Feb 11, 2014, at 3:38 PM, Ranjib Dey <dey.ranjib@gmail.commailto:dey.ranjib@gmail.com> wrote:

Hi Curtis,
out of curiosity , any reason you dont want to use the aws-sdk’s ruby api directly to enlist and get all the objects md5? wont it be much cleaner?

On the shellout error, this will be problematic if large number of files are in the bucket, as you are parsing the entire stdout content,

http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/S3Object.html

On Tue, Feb 11, 2014 at 1:10 PM, Julian C. Dunn <jdunn@aquezada.commailto:jdunn@aquezada.com> wrote:
Only thing I can think of is this:

https://tickets.opscode.com/browse/CHEF-4794

  • Julian

On Tue, Feb 11, 2014 at 4:58 PM, Stewart, Curtis
<cstewart@momentumsi.commailto:cstewart@momentumsi.com> wrote:

On a handful of recipes, we’re getting the following errors and cannot seem
to avoid them. The pattern appears to be with any Mixlib::ShellOut
commands.

Working in a chef-repo.

chef-client v11.8.0
chefspec v3.1.4

We’re currently running specs on our entire repo through a Jenkins server.

recipe code:

cmd1 = Mixlib::ShellOut.new(“s3cmd info #{node[‘app’][‘s3_source’]} | grep
MD5 | awk ‘{print $3}’”).run_command

error:

Errno::ENOMEM:
Cannot allocate memory - fork(2)

Thanks,
Curtis


[ Julian C. Dunn <jdunn@aquezada.commailto:jdunn@aquezada.com> * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/http://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]