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

Process.spawn using huge amounts of memory for simple script #3054

Closed
djberg96 opened this Issue Jun 15, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@djberg96
Contributor

djberg96 commented Jun 15, 2015

jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-06-15 0af53f6 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]

# test.rb
#!/usr/bin/env ruby
puts "hello"
warn "whut?"
raise "oops!"

# spawntest.rb
file = File.join(__dir__, 'test.rb')
Process.spawn(file, :out => ['test.log', 'a'])

>ruby spawntest.rb
Error: Your application used more memory than the safety cap of 500M.
Specify -J-Xmx####m to increase it (#### = cap size in MB).
Specify -w for full OutOfMemoryError stack trace
@bbrowning

This comment has been minimized.

Show comment
Hide comment
@bbrowning

bbrowning Jun 17, 2015

Contributor

This looks like another bug in JRuby. In this case, there's a loop with a counter that never increments which means it's an infinite loop. The OOM just happens because it's infinitely adding entries into an ArrayList.

for (i = 0; i < ary.size();) {

The loop counter i is never being updated inside the body of the loop nor is the loop broken out of. It's probably just missing an i++ at the end of the for statement itself.

Contributor

bbrowning commented Jun 17, 2015

This looks like another bug in JRuby. In this case, there's a loop with a counter that never increments which means it's an infinite loop. The OOM just happens because it's infinitely adding entries into an ArrayList.

for (i = 0; i < ary.size();) {

The loop counter i is never being updated inside the body of the loop nor is the loop broken out of. It's probably just missing an i++ at the end of the for statement itself.

@djberg96

This comment has been minimized.

Show comment
Hide comment
@djberg96

djberg96 Jun 17, 2015

Contributor

Yep, looks like it originally depended on an increment that has since been commented out.

Contributor

djberg96 commented Jun 17, 2015

Yep, looks like it originally depended on an increment that has since been commented out.

@djberg96

This comment has been minimized.

Show comment
Hide comment
@djberg96

djberg96 Jun 17, 2015

Contributor

Fixed by #3061, thanks for merging!

Contributor

djberg96 commented Jun 17, 2015

Fixed by #3061, thanks for merging!

@djberg96 djberg96 closed this Jun 17, 2015

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Jun 17, 2015

Member

Thanks for supplying the patch. So do we pass on long spec run now with this change? Certainly if we didn't it would be better than an infinite loop :)

Member

enebo commented Jun 17, 2015

Thanks for supplying the patch. So do we pass on long spec run now with this change? Certainly if we didn't it would be better than an infinite loop :)

@djberg96

This comment has been minimized.

Show comment
Hide comment
@djberg96

djberg96 Jun 17, 2015

Contributor

@enebo I'm not sure what you mean by a long spec run. Or were you talking to Ben?

Contributor

djberg96 commented Jun 17, 2015

@enebo I'm not sure what you mean by a long spec run. Or were you talking to Ben?

@bbrowning

This comment has been minimized.

Show comment
Hide comment
@bbrowning

bbrowning Jun 18, 2015

Contributor

@enebo This change fixed the OOM in the long spec run but it still fails with "Errno::ENOENT: No such file or directory - /scratch/jenkins/workspace/jruby-master-spec-ruby/rubyspec_temp/1582-kernel_spawn.txt" - see https://projectodd.ci.cloudbees.com/job/jruby-master-spec-ruby/43/console.

Contributor

bbrowning commented Jun 18, 2015

@enebo This change fixed the OOM in the long spec run but it still fails with "Errno::ENOENT: No such file or directory - /scratch/jenkins/workspace/jruby-master-spec-ruby/rubyspec_temp/1582-kernel_spawn.txt" - see https://projectodd.ci.cloudbees.com/job/jruby-master-spec-ruby/43/console.

@enebo enebo added the JRuby 9000 label Jul 6, 2015

@enebo enebo added this to the JRuby 9.0.0.0.rc2 milestone Jul 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment