kazeburo / Gazelle

Preforked Plack Handler for performance freaks
https://metacpan.org/release/Gazelle
Other
74 stars 19 forks source link

changed SIGTERM handling in the parent to shutdown the socket #23

Closed markwellis closed 8 years ago

markwellis commented 8 years ago

so that new connections will not hang, and instead will return "connection refused".

Existing connections will continue until finished, then shutdown as well.

markwellis commented 8 years ago

as far as i've tested, this works ok. I'm going to run it on out production environment shortly, and will be alerted of any errors.

my testing went like this. i had a small psgi app that accepted a POST, and printed it back to the client, or a GET and printed 'hello world'. i ran this with 2 workers. i ran a rate limited curl upload on one worker, and a regular GET request on the other to make sure it was working as expected.

then i kill -SIGTERM the master pid, and try the GET request, it returned connection refused, and the POST contiuned upload, and then download, and i compared the uploaded vs downloaded.

without this patch, the GET request after the SIGTERM will hang, which was causing us "Server closed connection without sending any data back" errors.

I can't think of a way to unit test this properly unfortuantly

markwellis commented 8 years ago

OK. I've tested our setup with and without this, and it definitely helps. So reopening

markwellis commented 8 years ago

bump

markwellis commented 8 years ago

thanks @kazeburo :+1: