-
-
Notifications
You must be signed in to change notification settings - Fork 579
Bug: Buffalo app is never gracefully shut down #2198
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
Indeed, it looks like you found a serious bug which should be addressed as soon as possible! I tested the behavior with my test application and I am working on it. Please let me take a look into the issue and I will get back as soon as possible. |
Hi @sio4, thanks for your reply and much more important the fix :) |
Hi @elivlo, could you please check if the issue is resolved with the |
Description
I might have discovered a bug shutting down the buffalo app. I wanted to listen for the event
EvtAppStop
and never received it. Then I looked into the fileserver.go
. I wondered that no log message containedShutting down application
, so I dived deeper into the code. The buffalo server is not implementing the concurrency model the right way, if I'm understanding it right. See here.I think the code is at least missing something in this go routine (and maybe somewhere else):
buffalo/server.go
Lines 20 to 97 in 1f21020
I tested with buffalo version v0.18.2 and go1.17.5. It seems that the goroutine (for shutdown) has no time to run when SIGTERM or SIGINT stops the application.
Steps to Reproduce the Problem
I created a new buffalo app with
buffalo new
. Then I started and stopped it in production and development mode.Also add the following lines to
main.go
:buffalo new testapp --api
buffalo build -o testapp
./testapp
+ Hit CTRL+C
+
kill -s SIGTERM <pid>
+
kill -s SIGINT <pid>
Expected Behavior
Buffalo should wait until all application processes are terminated. This also includes functions that run on shut down in my opinion.
Actual Behavior
Info
The text was updated successfully, but these errors were encountered: