BJ - Reaping 1 threads for slow workers because of 'shutdown'

I’m calling Bj from inside a controller in rails.

controller code

http://pastie.org/239415

Its running a simple script that logs the user to the database.
Obviously this isn’t a good candidate for a background job, this is
just something simple I’m using to test.

bj script code

http://pastie.org/239418

When I shutdown rails, I get a timeout error from mongrel

log snippet

http://pastie.org/239419

Any ideas why mongrel is holding on to that thread? I am calling
exit_success! at the end of my run action in the bj script, it appears
the script is exiting properly.

I also find it strange that the sessions_controller is referred to in
that backtrace.

Any ideas?

Thanks
dusty doris

Here is an update. I tried in development vs production and that
didn’t make a difference. However, I only saw this behavior on
mongrel. On thin and webrick it would quit quickly.

On Jul 23, 2008, at 1:39 PM, dusty wrote:

Here is an update. I tried in development vs production and that
didn’t make a difference. However, I only saw this behavior on
mongrel. On thin and webrick it would quit quickly.

it’s a mongrel bug - mongrel tries to reap threads it does not own.
nothing to do with bj and you can safely ignore.

a @ http://codeforpeople.com/

Great. Thanks.

BTW - I’m having fun with Bj. Thanks for writing it!

-Dusty

it’s a mongrel bug - mongrel tries to reap threads it does not own.
nothing to do with bj and you can safely ignore.

But what’s the solution to it delaying the shutdown of mongrel?

On Aug 26, 2008, at 3:50 PM, fowlduck wrote:

But what’s the solution to it delaying the shutdown of mongrel?

patch mongrel.

bj doesn’t delay the shutdown - it merely creates a thread which
mongrel insists on reaping. the fix is for mongrel not to reap
threads it hasn’t started.

a @ http://codeforpeople.com/