-
Notifications
You must be signed in to change notification settings - Fork 359
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
Fix memory leak with ruby/require/autoload_paths #3266
Merged
Fryguy
merged 1 commit into
ManageIQ:master
from
NickLaMuro:leak_fix_to_s_autoload_paths
Jan 18, 2018
Merged
Fix memory leak with ruby/require/autoload_paths #3266
Fryguy
merged 1 commit into
ManageIQ:master
from
NickLaMuro:leak_fix_to_s_autoload_paths
Jan 18, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In ruby versions less than 2.5.0, it was found that if you have Pathname objects in the $LOAD_PATH instead of regular strings, it messes with ruby's internals and causes a memory leak. In most ruby applications, this wouldn't be much of an issue, but there are a significant number of deferred require statements that we do in manageiq that cause this to leak overtime. Further more, this seems to be an issue that presents itself even if the file has been loaded previously (mostly a no-op for require). Replication of this issue can be done using a simple ruby script: require 'pathname' require 'fileutils' puts Process.pid Dir.mkdir("foo") unless Dir.exists?("foo") $LOAD_PATH.unshift(Pathname.new("foo")) FileUtils.touch("empty.rb") 1500.times { 1500.times { require "empty" }; print "."; GC.start; } By simply running the application with the Pathnames converted to strings, this should be a proper and low cost workaround for us until it is patched in ruby or we update manageiq to >= ruby 2.5.0.
@miq-bot add_label bug, performance |
3 tasks
kbrock
approved these changes
Jan 17, 2018
gtanzillo
approved these changes
Jan 17, 2018
Checked commit NickLaMuro@5fc7b05 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0 |
@miq-bot add_labels fine/yes, gaprindashvili/yes |
simaishi
pushed a commit
that referenced
this pull request
Jan 19, 2018
Fix memory leak with ruby/require/autoload_paths (cherry picked from commit 62653f6) https://bugzilla.redhat.com/show_bug.cgi?id=1536658
Gaprindashvili backport details:
|
simaishi
pushed a commit
that referenced
this pull request
Jan 19, 2018
Fix memory leak with ruby/require/autoload_paths (cherry picked from commit 62653f6) https://bugzilla.redhat.com/show_bug.cgi?id=1536672
Fine backport details:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In ruby versions less than 2.5.0, it was found that if you have
Pathname
objects in the$LOAD_PATH
instead of regular strings, it messes with ruby's internals and causes a memory leak.In most ruby applications, this wouldn't be much of an issue, but there are a significant number of deferred require statements that we do in
manageiq
that cause this to leak overtime. Further more, this seems to be an issue that presents itself even if the file has been loaded previously (mostly a no-op forrequire
).Replication of this issue can be done using a simple ruby script:
By simply running the application with the Pathnames converted to strings, this should be a proper and low cost workaround for us until it is patched in ruby or we update
manageiq
to >= ruby 2.5.0.Links
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1535720
Steps for Testing/QA
Being tested in ManageIQ/manageiq#16837