Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RubyMem: The Leaky Gems Database for Bundler at Ruby Kaigi Takeout 2020

RubyMem: The Leaky Gems Database for Bundler at Ruby Kaigi Takeout 2020

Out of memory errors are quite tricky. Our first reaction is always the same: "It can't be my code, it must be one of my dependencies!" What if you could quickly check that with bundler?

In this talk you will learn about memory leaks, out of memory errors, and leaky dependencies. You will learn how to use bundler-leak, a community-driven, open source tool that will make your life easier when debugging memory leaks.

Ernesto Tagwerker

September 04, 2020
Tweet

More Decks by Ernesto Tagwerker

Other Decks in Programming

Transcript

  1. Hi, I’m from Argentina I live in Philadelphia I <3

    drawing with my daughter I <3 Open Source
  2. What’s more likely? That Roda has a memory bug or

    that your code has a memory bug?
  3. Lessons Learned - Anyone can introduce a memory bloat -

    It’s easy to introduce it and hard to find
  4. Lessons Learned - Anyone can introduce a memory bloat -

    It’s easy to introduce it and hard to find - Great profiling tools in Ruby ❤
  5. Neat! None of my dependencies are known to be leaking

    memory. I’m going to debug my application code.
  6. $ bundle leak Name: net-http-persistent Version: 3.0.0 URL: https://github.com/drbrain/net-http- persistent/pull/98

    Title: Memory leak in thread connection pool of net-http-persistent Solution: upgrade to > 3.0.0 Leaks found!
  7. $ cat Gemfile.lock | grep net-http-persistent net-http-persistent (3.0.0) net-http-persistent (=

    3.0.0) $ cat Gemfile | grep net-http-persistent gem "net-http-persistent", "3.0.0"
  8. $ bundle-audit Name: actionpack Version: 3.2.10 URL: http://www.osvdb.org/show/osvdb/91452 Title: XSS

    vulnerability in sanitize_css in Action Pack Solution: upgrade to ~> 2.3.18, ~> 3.1.12, >= 3.2.13 Advisory: OSVDB-91452 Unpatched versions found!
  9. RubyMem needs your help - The more reports we get,

    the more value we can provide to the community. ❤
  10. RubyMem needs your help - The more reports we get,

    the more value we can provide to the community. ❤ - We are looking for contributors and co- maintainers!
  11. Resources 1. https://github.com/ohler55/oj/issues/228 2. https://github.com/ohler55/oj/issues/229 3. https://github.com/rubymem/ruby-mem-advisory-db 4. https://github.com/mperham/sidekiq/pull/2598 5.

    https://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby 6. https://github.com/fastruby/gggiiifff.com/pull/9/files 7. https://github.com/rubyjs/therubyracer/pull/336#issuecomment-88488472 8. https://gist.github.com/wvengen/f1097651c238b2f7f11d 9. http://www.be9.io/2015/09/21/memory-leak/ 10. https://github.com/mperham/sidekiq/issues/4652
  12. Resources 1. https://github.com/drbrain/net-http-persistent/pull/98/files 2. https://github.com/schneems/get_process_mem 3. https://www.toptal.com/ruby/hunting-ruby-memory-issues 4. https://github.com/schneems/derailed_benchmarks 5.

    https://www.youtube.com/watch?v=UCJsjr8ksDc 6. https://engineering.giphy.com/debugging-memory-leaks-in-swifts-enum-type/ 7. https://techlog360.com/limit-memory-usage-in-google-chrome/ 8. https://www.rubyguides.com/2016/09/object-space/