j2labs/brubeck — Issue #43: Brubeck apps don't release their Mongrel2 connections
Author: jordanorelli
Created: 2011-11-08 17:13:20+00:00
State: open

A broken Brubeck process can easily interfere with running Brubeck processes by stealing their requests. As an example, run two instances of a working Brubeck app. Next, swap the incoming/outcoming specifiers on the app's mongrel2_pair and run the app. Obviously this won't work properly, but there will be no indication that something is wrong. No kill this process. Even if killed gracefully with a SIGINT, it fails to release its Mongrel2 connection. Mongrel2 will continue to try to route requests to this process. In this example, one in three requests send to your project will fail, since the routing is done round-robin.

Proposal: fill in Brubeck.close() with an explicit release of the Mongrel2 connection or release the Mongrel2 connection in the Brubeck class's __del__ method. On SIGINT and KeyboardInterrupt, either explicitly delete the instance or call its close() method. I'm not sure which strategy gives the best guarantee of having a method called when the program exits.