Interrupted query causes "Rails application failed to start


Given a “find” screen that hooks to controller that does an sql find.
(this is a mysql db). Lets say you have a table with several thousand
rows and the find that you do will return a result containing every row
in the db. I.e. it takes 15 seconds or longer.

When I do this find and then click the “stop” button in my browser to
interrupt the query, then soon after try any other page of the app I get
the “Rails application failed to start properly” error after what seems
like enough time for the prior find to finally complete.

I think what I’m seeing is that if you “stop” the browser, the stop is
not conveyed into the application and is not stopping the database query
that was launched causing the app to wait on the completion of the

Is this possible? Known problem?

How do you prevent this behavior?


Not sure if it is related, but I was getting that same exact message
but because I was running under FastCGI and I had puts statments that
were getting evaluated. FastCGI receives the puts as the output
stream to be rendered to the browser, it doesn’t match what it
expects so it reports that Rails died. Perhaps your stop causes an
error message to print that makes FastCGi confused?

Bob E.


I don’t know what’s going on with the rails error, but your brower stop
button doesn’t
send anything to the app… it just stops the browser from waiting for
the response.

Welcome to the wonderful of web programming!


PS: Whe you have a long query like that you could return a “processing
your request”
progess page that has a refresh header to have it poll the server every
few seconds. You
could then put a “cancel query” link on there, that tells rails to canel
the query. Of
course, you’d still need to figure out how to tell the db to cancel the