Skip to content

Stack level too deep (SystemStackError) then raise exception in Sync. Then try to show warn in console #156

@znppaed7

Description

@znppaed7

Example:

    def example
      Sync do
        response = @internet.get('https://example.com')
        raise 'exception'
        [response.success?, response.status, response.read]
      end
    end

Result: ruby-3.2.1/gems/activesupport-7.0.4.2/lib/active_support/core_ext/object/instance_variables.rb:15:in `map': stack level too deep (SystemStackError)

Problem code:

in file console/terminal/logger.rb

def format_options(options, output)
  format_value(options.to_json, output)
end

The data Async::HTTP::Protocol::HTTP1::Client in the options field contains cyclic references. The to_json method is overridden in the active_support/core_ext/object/json.rb file.

class Object
  def as_json(options = nil) # :nodoc:
    if respond_to?(:to_hash)
      to_hash.as_json(options)
    else
      instance_values.as_json(options)
    end
  end
end

This method does not know how to resolve cyclic references.
This problem exists only in the rails framework. There is no problem without rails framework.

I have no suggestion on how to solve this problem...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions