This project is archived and is in readonly mode.

#2088 ✓stale
C. Bedard

Mongrel not being stopped with CTRL-C under Windows

Reported by C. Bedard | February 26th, 2009 @ 08:17 PM | in 3.x

Because of the way Rack::Handler::Mongrel instantiates the Mongrel::HttpHandler, it becomes impossible to shutdown the server with CTRL-C unless one actually enters CTRL-C and then hits the (still running) server.

This seems to be a Windows-only issue.

Attached is a patch which fixes this issue. This solution comes from the Mongrel gem source code.

Comments and changes to this ticket

  • James Herdman

    James Herdman April 6th, 2009 @ 09:39 PM

    • Tag changed from 2.3-rc1, mongrel, rack, server, windows to 2.3.2, mongrel, rack, server, windows

    May I suggest submitting this patch to the Rack team? It might be more applicable there.

  • mkosma

    mkosma May 11th, 2009 @ 01:34 AM

    Running rails via gem 2.3.2. (Also have installed the gem for mongrel 1.1.5, but I take it that appears elsewhere.) I can confirm the problematic behavior described, and confirm that this patch fixes the silly mongrel.

    I manually applied the patch by adding the two new lines (trap & sleeper_thread) to mongrel.rb in c:\ruby\lib\ruby\gems\1.8\gems\actionpack-2.3.2\lib\action_controller\vendor\rack-1.0\rack\handler>.

    There must be a better way to manage patches like this. Googled a ton but found no answer that made sense. Do I need to get off the gems and start using git? freeze rails 2.3.2?

    Thoughts appreciated, or better yet a link as this is probably the wrong place for this question.

  • raggi

    raggi August 19th, 2009 @ 09:18 AM

    I think this only affects the very old VS 6.0 builds, though?

    The bug is actually in IO blocking in the ruby interpreter itself.

    Update your compiler and interpreter, and the issue should go away.

    Can anyone confirm this (I'm relatively sure)?

  • Charles Roper

    Charles Roper March 22nd, 2010 @ 05:54 PM

    According to Luis Lavena, maintainer of RubyInstaller on Windows, this problem isn't related to the compiler. I can confirm the issue is still present on the newer mingw builds.

    Here's a thread discussing it:

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:53 PM

    • State changed from “new” to “open”
    • Tag changed from 2.3.2, mongrel, rack, server, windows to server, 232, mongrel, rack, windows
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:53 PM

    • State changed from “open” to “stale”
    • Tag changed from server, 232, mongrel, rack, windows to server, 232, mongrel, rack, windows

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>