Last active
December 14, 2015 13:38
-
-
Save romansergey/5094798 to your computer and use it in GitHub Desktop.
Celluloid stack failure
This file contains 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
Starting server... | |
E, [2013-03-05T22:49:49.841000 #13369] ERROR -- : MyServer crashed! | |
IOError: closed stream | |
org/nio4r/Nio4r.java:143:in `register' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-io-0.12.1/lib/celluloid/io/reactor.rb:42:in `wait' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-io-0.12.1/lib/celluloid/io/reactor.rb:21:in `wait_readable' | |
org/jruby/RubyBasicObject.java:1665:in `__send__' | |
org/jruby/RubyKernel.java:1809:in `public_send' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `dispatch' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-0.12.4/lib/celluloid/actor.rb:327:in `handle_message' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-0.12.4/lib/celluloid/tasks/task_fiber.rb:24:in `initialize' | |
/home/me/.rvm/gems/jruby-1.7.2/gems/celluloid-0.12.4/lib/celluloid/tasks/task_fiber.rb:23:in `initialize' |
This file contains 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
require 'reel' | |
require 'java' | |
Dir["lib/java/\*.jar"].each { |jar| require jar } | |
require 'sdb_client_proxy' | |
require 'async_handler' | |
class MyServer < Reel::Server | |
def initialize(host = "127.0.0.1", port = 3000) | |
sdb_client = com.amazonaws.services.simpledb.AmazonSimpleDBAsyncClient.new( | |
com.amazonaws.auth.BasicAWSCredentials.new(KEY,SECRET) | |
) | |
@sdb_client_pool = SimpleDBClientProxy.pool(size: 100, args: [sdb_client]) | |
super(host, port, &method(:on_connection)) | |
end | |
def on_connection(connection) | |
while request = connection.request | |
case request | |
when Reel::Request | |
connection.detach | |
handle_request(request) | |
when Reel::WebSocket | |
# =) | |
end | |
end | |
end | |
def handle_request(request) | |
@sdb_client_pool.async.find("production_users-1","783a3202-e167-41f6-a441-a4ce3fc12573") do |hash| | |
request.respond :ok, hash.to_s | |
end | |
end | |
end | |
puts "Starting server..." | |
MyServer.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Happens when load testing Reel