Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ungraceful stop #947

Closed
jixam opened this issue Apr 25, 2016 · 2 comments
Closed

Ungraceful stop #947

jixam opened this issue Apr 25, 2016 · 2 comments
Labels

Comments

@jixam
Copy link
Contributor

jixam commented Apr 25, 2016

This one-liner creates a server that fails every other request (as the server restarts):

perl -E 'use Mojo::Server::Prefork; Mojo::Server::Prefork->new(workers=>1, accepts=>2)->run;'

The bug bisects to 7eb7346 and this patch seems to fix it:

--- a/lib/Mojo/IOLoop.pm
+++ b/lib/Mojo/IOLoop.pm
@@ -142,7 +142,7 @@ sub stop { _instance(shift)->reactor->stop }

 sub stop_gracefully {
   my $self = _instance(shift)->_not_accepting;
-  ++$self->{stop} and !$self->emit('finish')->_in and $self->stop;
+  $self->{stop}++ and !$self->emit('finish')->_in and $self->stop;
 }

 sub stream {

I cannot claim to fully understand what's happening, so other changes may be needed.

@kraih kraih added the bug label Apr 25, 2016
@kraih
Copy link
Member

kraih commented Apr 25, 2016

I can confirm the problem, but the proposed patch does not look like a solution.

@kraih kraih closed this as completed in 80a4f3f Apr 25, 2016
@kraih
Copy link
Member

kraih commented Apr 25, 2016

Thanks, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants