Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Rescue Java::JavaLang::OutOfMemoryError and print a useful error message #4673

Closed
indirect opened this issue Jun 14, 2016 · 2 comments
Closed

Comments

@indirect
Copy link
Member

indirect commented Jun 14, 2016

As reported in #4572, it's very possible for Bundler to run the JVM out of memory, especially on memory-constrained JVM instances. We should rescue this error and print an explanatory message, rather than barfing a stacktrace and asking users to report the bug as a new issue. Here's a draft error message:

Your JVM has run out of memory, and Bundler cannot continue. You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB).

@segiddins
Copy link
Member

Can just add this to friendly_errors

@headius
Copy link
Contributor

headius commented Jun 14, 2016

FWIW, JRuby already will display such a message if the OOM bubbles all the way out, and memory errors can be notoriously tricky to rescue (because we're at a memory limit already). Feel free to add this message if it fits the rest of the system though, and let me know if you have any trouble rescuing the error.

@coilysiren coilysiren added this to the 1.X -- Better Platform Support milestone Jun 17, 2016
@indirect indirect removed this from the 1.14 — Better Platform Support milestone Aug 9, 2016
homu added a commit that referenced this issue Sep 30, 2016
[FriendlyErrors] Print a custom message on Java::JavaLang::OutOfMemor…

…yError

Closes #4673
hsbt pushed a commit to rubygems/bundler-graph that referenced this issue Oct 19, 2021
[FriendlyErrors] Print a custom message on Java::JavaLang::OutOfMemor…

…yError

Closes rubygems/bundler#4673
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants