[MacRuby] #1240: Seg fault requiring Sinatra Module
#1240: Seg fault requiring Sinatra Module -------------------------------------+-------------------------------------- Reporter: adam_kenger@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: sinatra module segmentation fault -------------------------------------+-------------------------------------- When requiring a Sinatra module in MacRuby 0.10 I get a Segmentation Fault. I'm not entirely sure how to capture any more detail. {{{ irb(main):001:0> require 'sinatra' => true irb(main):002:0> module Sinatra irb(main):003:1> module SinatraTest irb(main):004:1> end irb(main):005:1> register SinatraTest irb(main):006:0> end Segmentation fault }}} Works ok if you just require sinatra/base {{{ irb(main):001:0> require 'sinatra/base' => true irb(main):002:0> module Sinatra irb(main):003:1> module SinatraTest irb(main):004:1> end irb(main):005:1> register SinatraTest irb(main):006:0> end => [Sinatra::SinatraTest] }}} Gem list: control_tower (1.0) haml (3.0.25) rack (1.2.1) rack-flash (0.1.1) sequel (3.22.0) sinatra (1.2.3) sqlite3 (1.3.3) tilt (1.2.2) -- Ticket URL: <http://www.macruby.org/trac/ticket/1240> MacRuby <http://macruby.org/>
#1240: Seg fault requiring Sinatra Module -------------------------------------+-------------------------------------- Reporter: adam_kenger@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: sinatra module segmentation fault -------------------------------------+-------------------------------------- Comment(by lsansonetti@…): Looks like a #send recursive loop. The code that triggers it seems to be in sinatra/base.rb: {{{ module Delegator #:nodoc: def self.delegate(*methods) methods.each do |method_name| eval <<-RUBY, binding, '(__DELEGATE__)', 1 def #{method_name}(*args, &b) ::Sinatra::Application.send(#{method_name.inspect}, *args, &b) end private #{method_name.inspect} RUBY end end }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1240#comment:2> MacRuby <http://macruby.org/>
#1240: Seg fault requiring Sinatra Module -------------------------------------+-------------------------------------- Reporter: adam_kenger@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: sinatra module segmentation fault -------------------------------------+-------------------------------------- Comment(by lsansonetti@…): Called from: {{{ def self.register(*extensions, &block) #:nodoc: added_methods = extensions.map {|m| m.public_instance_methods }.flatten Delegator.delegate(*added_methods) super(*extensions, &block) end }}} Because #send is part of the methods to delegate, it creates a recursive call. Reduction: {{{ $ ./miniruby -e "module M; end; p M.public_instance_methods" [:to_plist, :Complex, :Rational, :enum_for, :to_enum, :object_id, :__id__, :define_singleton_method, :public_method, :method, :extend, :respond_to_missing?, :respond_to?, :public_send, :send, :__send__, :instance_exec, :instance_eval, :__callee__, :__method__, :tap, :is_a?, :kind_of?, :instance_of?, :instance_variable_defined?, :instance_variable_set, :instance_variable_get, :instance_variables, :public_methods, :private_methods, :protected_methods, :singleton_methods, :methods, :inspect, :to_s, :untrusted?, :untrust, :trust, :frozen?, :freeze, :untaint, :tainted?, :taint, :__type__, :dup, :clone, :<=>, :eql?, :!~, :=~, :===, :nil?, :!=, :!, :==, :equal?] $ ruby1.9 -e "module M; end; p M.public_instance_methods" [] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1240#comment:3> MacRuby <http://macruby.org/>
#1240: Seg fault requiring Sinatra Module -------------------------------------+-------------------------------------- Reporter: adam_kenger@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: sinatra module segmentation fault -------------------------------------+-------------------------------------- Comment(by lsansonetti@…): So this is the same problem as #1238, in a way. -- Ticket URL: <http://www.macruby.org/trac/ticket/1240#comment:4> MacRuby <http://macruby.org/>
#1240: Seg fault requiring Sinatra Module -----------------------------------------------+---------------------------- Reporter: adam_kenger@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: sinatra module segmentation fault | -----------------------------------------------+---------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: Should be fixed in https://github.com/MacRuby/MacRuby/commit/bfcea02f4036e5fb7c7f674564c9f8cf6e... -- Ticket URL: <http://www.macruby.org/trac/ticket/1240#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby