You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In large applications it may be havy hash object. So when sentry try to cast this with #to_s that causes to large CPU consumption. I.e. in our application it takes around 45 sec to perform and almost 100% CPU load).
And the result just throwed away because this is not headers that needs to be in the event.
@moofkit thanks for pointing this out & the PR! I'd love to merge it right away, but we're managing the release of these 2 gems separately. so can you split this PR into 2?
This file contains hidden or 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
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.
Description
There is performance issue with
sentry-ravenandsentry-rubygems.In some cases different middlewares assign to
envhash some large objects.I.e. grape expose his routing in
env['grape.routing_args']https://github.com/ruby-grape/grape/blob/02d7113d09eb9fcb4264c841d1fdd305e3e8adb5/lib/grape/util/env.rb#L22In large applications it may be havy hash object. So when
sentrytry to cast this with#to_sthat causes to large CPU consumption. I.e. in our application it takes around 45 sec to perform and almost 100% CPU load).And the result just throwed away because this is not headers that needs to be in the event.
There are some demo that emulates this issue https://gist.github.com/moofkit/e1bf1ca0d3186aa7f9b89d3c3ee7fc58
You can try it with
Why it takes 10 secs of 5 is covered in this issue #777
So, this little patch postpone
Object#to_safter all headers checks in bothsentry-ravenandsentry-rubygems