Hello, i''m trying to implement handling of http Expect: 100-continue with unicorn in my rails app, but when i return [100] as a response (which should force unicorn to return 100 status and rerun my app with the same connection) i get this error: Read error: #<ThreadError: stopping only thread note: use sleep to stop forever> /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in `lock'' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in `run'' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'' /var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call'' /var/lib/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call'' /var/lib/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'' /var/lib/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'' /var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:576:in `process_client'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:643:in `worker_loop'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:641:in `each'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:641:in `worker_loop'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:534:in `spawn_missing_workers'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:534:in `fork'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:534:in `spawn_missing_workers'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:530:in `each'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:530:in `spawn_missing_workers'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:540:in `maintain_worker_count'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:215:in `start'' /var/lib/gems/1.8/gems/unicorn-0.95.1/lib/unicorn.rb:28:in `run'' /var/lib/gems/1.8/gems/unicorn-0.95.1/bin/unicorn_rails:207 /var/lib/gems/1.8/bin/unicorn_rails:19:in `load'' /var/lib/gems/1.8/bin/unicorn_rails:19 Any idea about what''s wrong ? Thanks, Jan
On Wed, 09 Dec 2009 22:05:21 +0100, Jan Dvorak wrote:> Hello, > > i''m trying to implement handling of http Expect: 100-continue with > unicorn in my rails app, but when i return [100] as a response (whichJust out of curiosity: what does 100 Continue mean and how can you use it (usefully)?
Jan Dvorak <jan.dvorak at kraxnet.cz> wrote:> Hello, > > i''m trying to implement handling of http Expect: 100-continue with > unicorn in my rails app, but when i return [100] as a response (which > should force unicorn to return 100 status and rerun my app with the same > connection) i get this error: > > Read error: #<ThreadError: stopping only thread > note: use sleep to stop forever> > /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:31:in > `lock''Hi Jan, Try disabling automatic code reloading under Rails development mode. Unicorn (and Rainbows!) are the only Ruby servers I know of that allow Rack applications to properly return and continue with 100 responses. Unicorn calls your Rack app twice in this case: it sees a 100 response, writes the 100-continue response and then does app.call(env) again after deleting the "Expect: 100-continue" header from env. I haven''t tested this under Rails so I don''t know how well it works with what Rails does under the covers, but I''ve done this heavily with bare Rack applications. -- Eric Wong
David Palm <dvdplm at gmail.com> wrote:> On Wed, 09 Dec 2009 22:05:21 +0100, Jan Dvorak wrote: > > Hello, > > > > i''m trying to implement handling of http Expect: 100-continue with > > unicorn in my rails app, but when i return [100] as a response > > (which > > Just out of curiosity: what does 100 Continue mean and how can you use > it (usefully)?Hi David, It''s described in the HTTP/1.1 spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3 curl uses it by default: http://curl.haxx.se/docs/faq.html#My_HTTP_POST_or_PUT_requests_are There are several uses of them in the Rainbows! test cases: $ git clone git://git.bogomips.org/rainbows $ grep HTTP_EXPECT rainbows/t/*.ru -- Eric Wong
Eric Wong wrote:> Hi Jan, > > Try disabling automatic code reloading under Rails development mode. > >Thanks, that worked.> Unicorn (and Rainbows!) are the only Ruby servers I know of that allow > Rack applications to properly return and continue with 100 responses. > > Unicorn calls your Rack app twice in this case: it sees a 100 response, > writes the 100-continue response and then does app.call(env) again after > deleting the "Expect: 100-continue" header from env. > > I haven''t tested this under Rails so I don''t know how well it works with > what Rails does under the covers, but I''ve done this heavily with bare > Rack applications. > >After googling, it seems like rails error, it creates locks but never properly releases them, and deadlocks upon class reloading. Thanks, Jan