mperham / girl_friday

Have a task you want to get done but don't want to do it yourself? Give it to girl_friday!
http://mperham.github.com/girl_friday
MIT License
606 stars 26 forks source link

Doesn't work with Passenger #49

Closed pranas closed 12 years ago

pranas commented 12 years ago

Hi,

I can't get girl_friday working with Passenger. I've bare Rails app https://github.com/Pranas/girl_friday_test . I'm using Ruby 1.9.3-p125, Rails 3.2 and Passenger 3.0.11. Steps to reproduce:

  1. gem install passenger
  2. passenger start
  3. hit http://localhost:3000

It should print 'ok' and touch /tmp/test123 file.

jc00ke commented 12 years ago

Passenger isn't supported because it's based on an event loop, not threads like unicorn or puma.

jrochkind commented 12 years ago

Hi, is this a revision of the answer in #38, which suggested Passenger would work just fine so long as you have it do conservative spawning, and/or create queues lazily?

Which is correct, Passenger can work with a few simple accomodations, or Passenger is right out?

jc00ke commented 12 years ago

Passenger is not supported as a viable app server. If you figure it out, please let us know & we can update the docs. I suppose it might be possible to get Passenger & girl_friday to play nicely together, but it may not be easy.

jrochkind commented 12 years ago

Thanks. Is there any 'elevator speech' overview of what the problems
are?

I basically have my own handmade custom background thread solution
that I use in a Rails app, which seems to deploy just fine under
Passenger. I was investigating switching to girl_friday. I wonder
what's going on with passenger/girl_friday interaction that hasn't
seemed to have bitten my homegrown threaded solution.

jc00ke commented 12 years ago

The root is that running threads in an evented server can be trouble. Not saying you can't do it, we just say we don't support it :wink:

jrochkind commented 12 years ago

Hmm, I have no idea what that means. I guess if I get the time/ motivation I'll try it and see what happens. Although I don't like the
idea of running something where the people who DO understand it tell
me there might be problems, that I clearly don't understand well
enough to recognize or debug if they happen, or predict when they might!

I have learned more than I ever wanted to know about ruby, threading,
Rails and ActiveRecord, in my current efforts to write my own threaded
handling in a rails app from scratch, but haven't (yet cross fingers)
run into any problems with passenger doing anything problematic.

On Mar 22, 2012, at 6:53 PM, Jesse Cooke wrote:

The root is that running threads in an evented server can be
trouble. Not saying you can't do it, we just say we don't support
it :wink:


Reply to this email directly or view it on GitHub: https://github.com/mperham/girl_friday/issues/49#issuecomment-4650187

jrochkind commented 12 years ago

Huh, googling around to figure out exactly what 'evented' means in
this case for Passenger, I find an interview with Passenger developers
claiming that Passenger right now does not use an 'an evented I/O
architecture' (although future versions will), but uses a
'multithreaded I/O architecture'. I guess I'm just out of my league,
I'm lost already. http://www.infoq.com/news/2012/02/ruby-eee-eol

On Mar 22, 2012, at 6:53 PM, Jesse Cooke wrote:

The root is that running threads in an evented server can be
trouble. Not saying you can't do it, we just say we don't support
it :wink:


Reply to this email directly or view it on GitHub: https://github.com/mperham/girl_friday/issues/49#issuecomment-4650187

jrochkind commented 12 years ago

I wonder if it's not 'evented' that's been a problem, but just the
need to make sure you re-fill your thread pool after Passenger forks a
new copy of an app? http://www.modrails.com/documentation/Users%20guide%20Apache.html#_smart_spawning_gotcha_2_the_need_to_revive_threads

I dunno, anyways, I guess if I have time and motivation i'll try it
and see.

mperham commented 12 years ago

Passenger and Unicorn are not evented. thin is evented.

Passenger is supported, you just need to create your girl_friday queues within Passenger's starting_worker_process block. Unicorn has the same issue: read more in #47.

jrochkind commented 12 years ago

Thanks! This seems to come up and get conflicting answers in the
issues, perhaps note in initial README what webservers are supported,
and special instructions for passenger?

Note though, that I did find that Passenger is looking at switching
to be evented in the next release, so, there's that. I still don't
understand exactly what issues this causes for threads, but sounds
like it could be a problem.