Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

unclosed subscribe segfaults the rubyvm #8

Closed
eqv opened this issue Jun 5, 2013 · 7 comments
Closed

unclosed subscribe segfaults the rubyvm #8

eqv opened this issue Jun 5, 2013 · 7 comments

Comments

@eqv
Copy link

eqv commented Jun 5, 2013

This sample will segfault the ruby vm:

require 'redis'
require 'celluloid/io'
require 'celluloid/redis'

    class Runner
        include Celluloid::IO
        attr_accessor :redis
        def initialize
            async.run
        end

        def run()
            @redis = ::Redis.new(:driver => :celluloid)
            @redis.subscribe("foo", "bar") {}
        end
    end
    r = Runner.new
    exit #crashes since r.redis is still subscribed
@tarcieri
Copy link
Member

tarcieri commented Jun 5, 2013

Pretty much every Celluloid-implicated segv so far has been due to MRI
bugs. Can you post the version of MRI you're using and the complete stack
trace including the segv components?

Also: try MRI 2.0 or JRuby and see if that solves the segvs

Tony Arcieri

On Jun 5, 2013, at 1:34 AM, ranmrdrakono notifications@github.com wrote:

This sample will segfault the ruby vm:

require 'redis'require 'celluloid/io'require 'celluloid/redis'

class Runner
    include Celluloid::IO
    attr_accessor :redis
    def initialize
        async.run
    end

    def run()
        @redis = ::Redis.new(:driver => :celluloid)
        @redis.subscribe("foo", "bar") { |on|
            on.message do |channel, message| redis.unsubscribe end
        }
    end
end
r = Runner.new
exit


Reply to this email directly or view it on
GitHubhttps://github.com//issues/8
.

@eqv
Copy link
Author

eqv commented Jun 5, 2013

crash log for 1.9.3
https://gist.github.com/ranmrdrakono/304a07d514488b08c3be

ruby version:

ruby -v 
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

gem versions:

gem list --local

*** LOCAL GEMS ***
 [...]
celluloid (0.14.1)
celluloid-io (0.14.1)
celluloid-redis (0.0.2)
 [...]
nio4r (0.4.6)
 [...]
rubygems-bundler (1.2.0, 1.1.0)
rvm (1.11.3.8, 1.11.3.5)

also: problem remains in ruby2.0:
https://gist.github.com/ranmrdrakono/b48334e74e55d833a162

@tarcieri
Copy link
Member

tarcieri commented Jun 5, 2013

Okay, thank you, this looks like it might actually be an nio4r bug at a cursory glance

@eqv
Copy link
Author

eqv commented Jun 5, 2013

should I resubmit the issue at nio4r?

@tarcieri
Copy link
Member

tarcieri commented Jun 5, 2013

Sure, that'd be great. It'd also be great if you can try JRuby and see what problems (if any) you're having there

@eqv
Copy link
Author

eqv commented Jun 12, 2013

while it does not produce a segfault under JRuby, it still crashes, which I assume to be a bug as well:
(https://gist.github.com/ranmrdrakono/c5dad69ed388f990f176)

@tarcieri
Copy link
Member

This make it look like we aren't safely detecting when something is trying register IO objects on a closed selector. That's likely a corner case in the nio4r API that isn't tested, and breaking in different ways on both the libev and Java NIO backends of nio4r.

Closing this issue in favor of the nio4r one

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants