scout_apm_ruby icon indicating copy to clipboard operation
scout_apm_ruby copied to clipboard

Use with jb gem, stack level too deep

Open walidvb opened this issue 5 years ago • 4 comments

Hi,

I'm having an issue when using the jb gem, getting a stack too deep error. Reason might be a similar one to the one described in #217 ?

error extract:

2019-04-18T00:43:29.469562+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/set.rb:306:in `each_key'
2019-04-18T00:43:29.469563+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/set.rb:306:in `each'
2019-04-18T00:43:29.469564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_children_set.rb:60:in `block in each'
2019-04-18T00:43:29.469570+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_children_set.rb:59:in `each'
2019-04-18T00:43:29.469572+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_children_set.rb:59:in `each'
2019-04-18T00:43:29.469573+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_converters/depth_first_walker.rb:33:in `walk'
2019-04-18T00:43:29.469574+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_converters/depth_first_walker.rb:36:in `block in walk'
2019-04-18T00:43:29.469576+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/scout_apm-2.4.20/lib/scout_apm/layer_children_set.rb:61:in `block (2 levels) in each'

full error available here: http://ix.io/1GuS Would love to get this working, currently having huge memory issues,and was hoping to make a step forward with this gem, and also monitor and enhance with scout

walidvb avatar Apr 18 '19 00:04 walidvb

Hi @walidvb - we fixed the interaction with View instruments and jb in the latest release. Can you update to 2.4.24 and try again?

cschneid avatar Apr 19 '19 05:04 cschneid

Hi @cschneid thanks for your answer. I was indeed using a previous version. I've reverted to jbuilder as i was experimenting performance issues and did want to have scout rather than jb. As soon as I get around to implementing jb again i will be sure to update this thread. Feel free to close it until then!

walidvb avatar Apr 22 '19 18:04 walidvb

Hi I'm give the same error at ActionMailer

[GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb:275 :in `-`

273       other.until(self)
274     else
275       minus_without_duration(other)
276     end
277   end

[GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb:275 :in `minus_with_duration`

273       other.until(self)
274     else
275       minus_without_duration(other)
276     end
277   end

[GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb:286 :in `minus_with_coercion`
[GEM_ROOT]/gems/scout_apm-2.5.1/lib/scout_apm/layer.rb:148 :in `total_call_time`

146     def total_call_time
147       if stop_time
148         stop_time - start_time
149       else
150         Time.now - start_time

[GEM_ROOT]/gems/scout_apm-2.5.1/lib/scout_apm/layer.rb:160 :in `block in child_time`

158     def child_time
159       children.
160         map { |child| child.total_call_time }.
161         inject(0) { |sum, time| sum + time }
162     end

[GEM_ROOT]/gems/scout_apm-2.5.1/lib/scout_apm/layer_children_set.rb:61 :in `block (2 levels) in each`

59       children.each do |_type, set|
60         set.each do |child_layer|
61           yield child_layer
62         end
63       end

And Administrate GEM

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/jaro_winkler.rb:69 :in `distance`

    67 
    68     def distance(str1, str2)
    69       jaro_distance = Jaro.distance(str1, str2)
    70 
    71       if jaro_distance > THRESHOLD

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/spell_checker.rb:16 :in `block in correct`

    14       threshold = input.length > 3 ? 0.834 : 0.77
    15 
    16       words = @dictionary.select {|word| JaroWinkler.distance(normalize(word), input) >= threshold }
    17       words.reject! {|word| input == word.to_s }
    18       words.sort_by! {|word| JaroWinkler.distance(word.to_s, input) }

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/spell_checker.rb:16 :in `select`

    14       threshold = input.length > 3 ? 0.834 : 0.77
    15 
    16       words = @dictionary.select {|word| JaroWinkler.distance(normalize(word), input) >= threshold }
    17       words.reject! {|word| input == word.to_s }
    18       words.sort_by! {|word| JaroWinkler.distance(word.to_s, input) }

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/spell_checker.rb:16 :in `correct`

    14       threshold = input.length > 3 ? 0.834 : 0.77
    15 
    16       words = @dictionary.select {|word| JaroWinkler.distance(normalize(word), input) >= threshold }
    17       words.reject! {|word| input == word.to_s }
    18       words.sort_by! {|word| JaroWinkler.distance(word.to_s, input) }

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/spell_checkers/method_name_checker.rb:17 :in `corrections`

    15 
    16     def corrections
    17       @corrections ||= SpellChecker.new(dictionary: method_names).correct(method_name) - NAMES_TO_EXCLUDE[@receiver.class]
    18     end

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/core_ext/name_error.rb:20 :in `corrections`

    18 
    19     def corrections
    20       spell_checker.corrections
    21     end

    /home/deployer/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/lib/did_you_mean/core_ext/name_error.rb:11 :in `to_s`

     9 
    10       if !cause.respond_to?(:corrections) || cause.corrections.empty?
    11         msg << DidYouMean.formatter.message_for(corrections)
    12       end

    [GEM_ROOT]/gems/actionview-5.2.3/lib/action_view/layouts.rb:418 :in `message`

    416         value = _layout(formats) if action_has_layout?
    417       rescue NameError => e
    418         raise e, "Could not render layout: #{e.message}"
    419       end

    [GEM_ROOT]/gems/actionview-5.2.3/lib/action_view/layouts.rb:418 :in `rescue in _default_layout`

    416         value = _layout(formats) if action_has_layout?
    417       rescue NameError => e
    418         raise e, "Could not render layout: #{e.message}"
    419       end

    [GEM_ROOT]/gems/actionview-5.2.3/lib/action_view/layouts.rb:415 :in `_default_layout`

    413     # * <tt>template</tt> - The template object for the default layout (or +nil+)
    414     def _default_layout(formats, require_layout = false)
    415       begin
    416         value = _layout(formats) if action_has_layout?
    417       rescue NameError => e

    [GEM_ROOT]/gems/actionview-5.2.3/lib/action_view/layouts.rb:392 :in `block in _layout_for_option`

    390       when Proc       then name
    391       when true       then Proc.new { |formats| _default_layout(formats, true)  }
    392       when :default   then Proc.new { |formats| _default_layout(formats, false) }
    393       when false, nil then nil
    394       else

    [GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb:19 :in `public_send`

    17         end
    18       else
    19         public_send(*a, &b)
    20       end
    21     end

    [GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb:19 :in `try!`

    17         end
    18       else
    19         public_send(*a, &b)
    20       end
    21     end

    [GEM_ROOT]/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb:8 :in `try`

    6   module Tryable #:nodoc:
    7     def try(*a, &b)
    8       try!(*a, &b) if a.empty? || respond_to?(a.first)
    9     end

    [GEM_ROOT]/gems/ddtrace-0.24.0/lib/ddtrace/contrib/rails/core_extensions.rb:60 :in `render_template_with_datadog`

    58                          layout_name
    59                        else
    60                          layout_name.try(:[], 'virtual_path')
    61                        end
    62               if template_name

    [GEM_ROOT]/gems/scout_apm-2.5.1/lib/scout_apm/instruments/action_view.rb:128 :in `render_template`

    126           begin
    127             req.start_layer(layer)
    128             super(*args)
    129           ensure
    130             req.stop_layer

    [GEM_ROOT]/gems/ddtrace-0.24.0/lib/ddtrace/contrib/rails/core_extensions.rb:80 :in `render_template_with_datadog`

    78 
    79             # execute the original function anyway
    80             render_template_without_datadog(*args)
    81           end

However in the 3.0 beta version this errors don't occurs.

ricsdeol avatar Jul 02 '19 20:07 ricsdeol

I will take a look

ioquatix avatar Jul 02 '19 21:07 ioquatix