GithubHelp home page GithubHelp logo

async-rails's Introduction

Async Rails 3.1 stack demo

Important warning:

You should be aware when using fibers with Rails that you can get a stack overflow error if your stack grows
bigger than 4Kb (which is enough for most things though), this got even worse with the 3.1 release in which
you can easily overflow the stack, here is an example here.

Simple async demo stack with Rails 3.1 + EventMachine and Fibers.

  • Hit localhost:3000/widgets to do a 1s async mysql query
  • Hit localhost:3000/widgets/http to make an HTTP call back to /widgets - recursive! :-)
  • Hit localhost:3000/twitter to load a mounted async Sinatra app (reports latests rails 3 tweets)

Howto / example commits:

Requirements:

  • Ruby 1.9.x
  • Async app server (thin)
  • Rails 3.1

Environment setup:

  • rvm install 1.9.2
  • rvm gemset create async-rails
  • rvm use 1.9.2@async-rails
  • gem install rails thin

Starting up Rails:

  • bundle install
  • bundle exec thin -D start

Concurrency

ab -c 5 -n 10 http://127.0.0.1:3000/widgets/

    Concurrency Level:      5
    Time taken for tests:   2.740 seconds
    Complete requests:      10

We're running on a single reactor, so above is proof that we can execute HTTP+MySQL queries in non-blocking fashion on a single run loop / within single process:

  • AB opens 5 concurrent requests (10 total)
  • Each request to /widgets/http opens an async HTTP request to /widgets - aka, we ourselves spawn another 5 requests
  • Because the fiber pool is set to 10, it means we can process all 5 requests within ~1s (each mysql req takes 1s)
  • 10 requests finish in ~2s

So, keep in mind that the size of 'database pool' is basically your concurrency throttle. In example above, we spawn 10 requests, which open another 10 internally, so in total we process 20 req's in ~2s on a single thing server. Just as expected.

Benchmarks

Pushing the stack on my MBP (db pool = 250; fiber pool = 250; env = production; thin 1.2.7) results in:

    Concurrency Level:      220
    Time taken for tests:   10.698 seconds
    Complete requests:      2000
    Failed requests:        0
    Write errors:           0
    Total transferred:      470235 bytes
    HTML transferred:       12006 bytes
    Requests per second:    186.95 [#/sec] (mean)
    Time per request:       1176.777 [ms] (mean)
    Time per request:       5.349 [ms] (mean, across all concurrent requests)
    Transfer rate:          42.93 [Kbytes/sec] received

For full AB trace see this gist

Resources:

Other:

async-rails's People

Contributors

dependabot[bot] avatar dkonishi avatar hakanensari avatar igrigorik avatar taf2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

async-rails's Issues

heroku eventmachine

hi guys. i have a problem when i try to deploy to heroku with bundler.

this is the error messages :
You have already activated eventmachine 0.12.10, but your Gemfile requires eventmachine 1.0.0.beta.2. Consider using bundle exec. (Gem::LoadError)
anyone could help me? i m running out times. thank u.

`resume': fiber called across threads (FiberError)

Greetinsg igrigorik

I had my 3.0.3 rails application use the async package em_mysql2, em-http-request, ... nearly all the setup in here.

my thins die with the following Fiber error. it is apparently thread handling on the em_mysql2 side..

I need your insights about the problem. below you'll find my list of used gems

Writing PID to tmp/pids/thin.0.pid
Changing process privilege to webistrano:webistrano
Using rack adapter
Thin web server (v1.3.1 codename Triple Espresso)
Maximum connections set to 1024
Listening on /tmp/elections.0.socket, CTRL+C to stop
Exiting!
/usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/mysql2-0.2.13/lib/active_record/connection_adapters/em_mysql2_adapter.rb:53:in resume': fiber called across threads (FiberError) from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/mysql2-0.2.13/lib/active_record/connection_adapters/em_mysql2_adapter.rb:53:inblock in query'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/em/deferrable.rb:158:in call' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/em/deferrable.rb:158:inset_deferred_status'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/em/deferrable.rb:198:in fail' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/mysql2-0.2.13/lib/active_record/connection_adapters/em_mysql2_adapter.rb:38:inrescue in notify_readable'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/mysql2-0.2.13/lib/active_record/connection_adapters/em_mysql2_adapter.rb:33:in notify_readable' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:inrun_machine'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:in run' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:instart'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in start' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:86:instart'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:185:in run_command' from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:151:inrun!'
from /usr/local/akhbarak/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/bin/thin:6:in <top (required)>' from /usr/local/bin/thin:19:inload'
from /usr/local/bin/thin:19:in `

'

bundle list
Gems included by the bundle:

  • abstract (1.0.0)
  • actionmailer (3.0.3)
  • actionpack (3.0.3)
  • activemodel (3.0.3)
  • activerecord (3.0.3)
  • activeresource (3.0.3)
  • activesupport (3.0.3)
  • addressable (2.2.6)
  • arel (2.0.10)
  • authlogic (2.1.6)
  • aws-s3 (0.6.2)
  • builder (2.1.2)
  • bundler (1.0.21)
  • cocaine (0.2.0)
  • daemons (1.1.4)
  • em-http-request (1.0.0)
  • em-socksify (0.1.0)
  • em-synchrony (1.0.0)
  • erubis (2.6.6)
  • eventmachine (1.0.0.beta.4)
  • factory_girl (2.2.0)
  • factory_girl_rails (1.3.0)
  • http_parser.rb (0.5.3)
  • i18n (0.6.0)
  • json (1.5.3)
  • mail (2.2.19)
  • mime-types (1.17.2)
  • mysql2 (0.2.13)
  • newrelic_rpm (3.3.0)
  • paperclip (2.3.16)
  • polyglot (0.3.3)
  • rack (1.2.4)
  • rack-fiber_pool (0.9.2)
  • rack-mount (0.6.14)
  • rack-test (0.5.7)
  • rails (3.0.3)
  • rails3-generators (0.17.4)
  • railties (3.0.3)
  • rake (0.8.7)
  • shoulda (2.11.3)
  • thin (1.3.1)
  • thor (0.14.6)
  • treetop (1.4.10)
  • tzinfo (0.3.30)
  • will_paginate (3.0.0)
  • xml-simple (1.1.1)

Rails 3.1 assets `stack level to deep`

Here is my solution for development environment to avoid stack level to deep for Rails 3.1.

Disable assets pipline in rails. Don't require sass-rails but instead require sass and sprockets in Gemfile.
Modified config.ru:

require ::File.expand_path('../config/environment',  __FILE__)

Sass::Engine::DEFAULT_OPTIONS[:load_paths].tap do |load_paths|
  load_paths << "app/assets/stylesheets"
  load_paths << Compass::Frameworks['compass'].stylesheets_directory
  load_paths << Compass::Frameworks['twitter_bootstrap'].stylesheets_directory
end

builder = Rack::Builder.new do
  map '/assets' do
    environment = Sprockets::Environment.new
    environment.append_path 'app/assets/javascripts'
    environment.append_path 'app/assets/stylesheets'
    run environment
  end

  map '/' do
    use Rack::FiberPool, :size => 250
    run YourApp::Application
  end
end
run builder

RackTimeout Blows up Thin in Async-Rails

Figured I start at the top. Have some async rails apps deployed to Heroku. I need to limit requests to less than 30 seconds so I implemented rack-timeout like we would for any app. Unfortunately whenever we reach our specified timeout the exception blows up eventmachine and thin killing the dyno.I tried using around_filters with EM.timer but produced the same results. Any idea as to how to work around this would be much appreciated.

Thanks

 => Booting Thin
 => Rails 3.0.20 application starting in sit on http://0.0.0.0:3000
 => Call with -d to detach
 => Ctrl-C to shutdown server
 >> Thin web server (v1.5.0 codename Knife)
 >> Maximum connections set to 1024
 >> Listening on 0.0.0.0:3000, CTRL+C to stop
 2013-02-05 14:40:49 -0600: GET - /tests/timeout.
 Exiting
 /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine': execution expired (Timeout::Error)
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/thin-1.5.0/lib/thin/backends/base.rb:63:in `start'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/thin-1.5.0/lib/thin/server.rb:159:in `start'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.2.7/lib/rack/handler/thin.rb:14:in `run'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.2.7/lib/rack/server.rb:217:in `start'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands/server.rb:65:in `start'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:30:in `block in <top (required)>'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:27:in `tap'
from /Users/jmckinney/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

test with rainbows

tested with rainbows and function really god

config of rainbow

worker_processes 4

Rainbows! do
use :EventMachine
worker_connections 1000
end

and in gemfile

gem 'rainbows'

What would it take to get this demo working with postgres?

I was able to get this sample app working with mysql quickly, and its really impressive to see the speed improvement. (Thanks for putting this together)

I wanted to see if I could achieve the same results with postgres, but it seems that it won't be as simple as just using the em_postgresql driver. (though the issues I'm running in to seem to be more related to that driver and rails 3)

I've also tried mperham's phat app.
I just wanted to see if anyone got this example to work with postgres

Configuration Question

I'm trying to configure async-rails demo as you indicated on "Pushing the stack on my MBP". Thus, I have the following questions:

  1. Is it necessary to add the following lines to the production.rb?

require 'em-activerecord'
require 'rack/fiber_pool'

Run each request in a Fiber

config.middleware.use Rack::FiberPool

  1. How does one set the fiber pool 250? From the blog on envylabs.com, you had indicated the
    db pool gets replaced by the fiber pool when using the Rack middleware, Rack::FiberPool.

  2. I had to change

gem 'eventmachine' , :git => 'git://github.com/eventmachine/eventmachine.git'

to

gem 'eventmachine'

to get things operational because I was getting the following error message when I ran
'thin -D start':

/Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in report_activate_error': Could not find RubyGem eventmachine (>= 0.12.6) (Gem::LoadError) from /Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:219:inactivate'
from /Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:254:in block in activate' from /Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:ineach'
from /Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in activate' from /Users/conradwt/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1065:ingem'
from /Users/conradwt/.rvm/gems/ruby-1.9.2-p0@async-rails/bin/thin:18:in `

'

no such file to load -- em/iterator

Maybe I'm doing something wrong here but which gem contains this library?

/Users/jpsilvashy/.rvm/gems/ruby-1.9.2-head/bundler/gems/em-mysqlplus-5ceee01679dc87691ab1affbf96f7dc8f5b251f7-master/lib/active_record/connection_adapters/em_mysqlplus_adapter.rb:1:in `require': no such file to load -- em/iterator (LoadError)

Fiber Pool: [BUG] Bus Error

I just started a fresh clone of async-rails and got this error? Is updating to ruby 1.9.3 really the only solution?? Thx

=> Booting Thin
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.2.11 codename Bat-Shit Crazy)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:75: [BUG] Bus Error
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]

-- control frame ----------
c:0028 p:---- s:0109 b:0109 l:000108 d:000108 CFUNC  :resume
c:0027 p:0067 s:0105 b:0105 l:000104 d:000104 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:75
c:0026 p:0026 s:0100 b:0100 l:000818 d:000818 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/rack/fiber_pool.rb:28
c:0025 p:0015 s:0095 b:0095 l:000094 d:000094 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/rack/content_length.rb:16
c:0024 p:0015 s:0086 b:0086 l:000085 d:000085 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/rack/log_tailer.rb:14
c:0023 p:0020 s:0081 b:0081 l:000072 d:000080 BLOCK  /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:84
c:0022 p:---- s:0079 b:0079 l:000078 d:000078 FINISH
c:0021 p:---- s:0077 b:0077 l:000076 d:000076 CFUNC  :catch
c:0020 p:0135 s:0073 b:0073 l:000072 d:000072 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:82
c:0019 p:0088 s:0068 b:0067 l:000066 d:000066 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:57
c:0018 p:0036 s:0064 b:0064 l:000063 d:000063 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:42
c:0017 p:---- s:0059 b:0059 l:000058 d:000058 FINISH
c:0016 p:---- s:0057 b:0057 l:000056 d:000056 CFUNC  :run_machine
c:0015 p:0248 s:0054 b:0054 l:000053 d:000053 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/eventmachine-1.0.0.beta.3/lib/eventmachine.rb:199
c:0014 p:0066 s:0047 b:0047 l:000b00 d:000b00 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/backends/base.rb:61
c:0013 p:0143 s:0043 b:0043 l:000042 d:000042 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/server.rb:159
c:0012 p:0081 s:0040 b:0040 l:000039 d:000039 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-1.3.2/lib/rack/handler/thin.rb:13
c:0011 p:0269 s:0034 b:0034 l:001c48 d:001c48 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-1.3.2/lib/rack/server.rb:265
c:0010 p:0231 s:0029 b:0029 l:001620 d:001620 METHOD /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands/server.rb:70
c:0009 p:0063 s:0025 b:0025 l:000016 d:000024 BLOCK  /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands.rb:54
c:0008 p:---- s:0022 b:0022 l:000021 d:000021 FINISH
c:0007 p:---- s:0020 b:0020 l:000019 d:000019 CFUNC  :tap
c:0006 p:0721 s:0017 b:0017 l:000016 d:000016 TOP    /Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands.rb:49
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :require
c:0003 p:0061 s:0006 b:0006 l:001988 d:001c18 EVAL   script/rails:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
script/rails:6:in `<main>'
script/rails:6:in `require'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands.rb:54:in `block in <top (required)>'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in `start'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-1.3.2/lib/rack/server.rb:265:in `start'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-1.3.2/lib/rack/handler/thin.rb:13:in `run'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/eventmachine-1.0.0.beta.3/lib/eventmachine.rb:199:in `run'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/eventmachine-1.0.0.beta.3/lib/eventmachine.rb:199:in `run_machine'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/thin-1.2.11/lib/thin/connection.rb:84:in `block in pre_process'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/rack/log_tailer.rb:14:in `call'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/railties-3.1.0/lib/rails/rack/content_length.rb:16:in `call'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/rack/fiber_pool.rb:28:in `call'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:75:in `spawn'
/Users/tobi/.rvm/gems/ruby-1.9.2-p290@async-rails/gems/rack-fiber_pool-0.9.2/lib/fiber_pool.rb:75:in `resume'

-- C level backtrace information -------------------------------------------
0   libruby.1.9.1.dylib                 0x000000010a30051e rb_vm_bugreport + 110
1   libruby.1.9.1.dylib                 0x000000010a1f4533 report_bug + 259
2   libruby.1.9.1.dylib                 0x000000010a1f46a1 rb_bug + 161
3   libruby.1.9.1.dylib                 0x000000010a296fb2 sigbus + 18
4   libsystem_c.dylib                   0x00007fff92c39cfa _sigtramp + 26
5   ???                                 0x00000000000000d5 0x0 + 213

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

eventmachine not initialized: evma_attach_fd

I just cloned the project. Ran bundle install. Added my MySQL development database. Then ran

rake db:install

I get the following error.

eventmachine not initialized: evma_attach_fd

I also tried

bundle exec rake db:migrate
, but this produced the same result.

My ruby version is ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.3.0]

I am very excited to get this up and running.

Failing with last version of em-synchrony

Trying to run rake db:create --trace with the last version of em-synchrony I'm getting this error:

% rake db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
undefined method `callback' for nil:NilClass
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-synchrony-eb0e0f21d7b6/lib/em-synchrony/mysql2.rb:16:in `query'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/mysql2_adapter.rb:281:in `execute'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/mysql2_adapter.rb:672:in `configure_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/mysql2_adapter.rb:129:in `initialize'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-synchrony-eb0e0f21d7b6/lib/active_record/connection_adapters/em_mysql2_adapter.rb:15:in `new'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/bundler/gems/em-synchrony-eb0e0f21d7b6/lib/active_record/connection_adapters/em_mysql2_adapter.rb:15:in `em_mysql2_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in `new_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `loop'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `block in checkout'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in `checkout'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in `connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in `retrieve_connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:86:in `rescue in create_database'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:54:in `create_database'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/guille/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/guille/.rbenv/versions/1.9.2-p290/bin/rake:19:in `load'
/Users/guille/.rbenv/versions/1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => db:create

Locking the version it works fine:

gem 'em-synchrony',     :git => 'git://github.com/igrigorik/em-synchrony.git', :require => [
  'em-synchrony',
  'em-synchrony/em-http',
  'em-synchrony/activerecord'
  ], :ref => '54194c00c65b7'

async-rails works not well with connection pool

Set up a new async-rails project. Once reload! or new a model will try to get connection from connetion pool but get nil.

rails c
>>reload!
Reloading...
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.clear
    from /Users/johnson/.rvm/gems/ruby-1.9.3-p0@e/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:144:in `clear_cache!'
......

>>User.new
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
    from /Users/johnson/.rvm/gems/ruby-1.9.3-p0@e/gems/activerecord-3.1.0/lib/active_record/base.rb:717:in `column_defaults'
......

ActionView::FileSystemResolver into String

Comming from this :

Footnotes #<Footnotes::Notes::PartialsNote:0x1072b7f48> Exception: can't convert ActionView::FileSystemResolver into String
/[...]/gems/rails-footnotes-3.7.1/lib/rails-footnotes/notes/partials_note.rb:38:in `join'

All it needs to get fixed is a .to_s after view_path :

path = File.join(view_path.to_s, "#{partial}*")

/twitter is erroring out with undefined method `[]' for false:FalseClass

Trying to get async-rails running with Rails 3.0.3 and the mysql2 gem as recommended. I'm not sure why this request is tossing an error. Everything else seems to be working correctly, and I can hit the twitter search url from my browser fine.

NoMethodError - undefined method [] for false:FalseClass:
async-rails/app/metal/twitter.rb:5:in block in <class:Twitter>
/Users/adam/.rvm/gems/ruby-1.9.2-p0@async-rails/gems/sinatra-1.1.2/lib/sinatra/base.rb:1058:in call

twitter.rb:5 is tweets = tweets['results'].collect {|t| t['text'] }.join("</br>")

Rails 4 async

Not sure if anyone has encountered following error when ab test async rails 4:

ThreadError: deadlock; recursive locking

When I run ab -c 5 -n 10 -v 2 http://127.0.0.1:3000/widgets, some requests fail with the error messages above:

Concurrency Level:      5
Time taken for tests:   2.021 seconds
Complete requests:      10
Failed requests:        6
   (Connect: 0, Receive: 0, Length: 6, Exceptions: 0)
Write errors:           0
Non-2xx responses:      4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.