You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When restarting a process, the runner calls cmd.Process.Kill() which immediately kills the process and does not allow it to clean up / shutdown.
This is an issue when using buffalo dev on a Buffalo application that runs a custom Server implementation. The custom server implementation has a context passed to Start() as well as a Shutdown() function. The Start() function never receives the context cancellation and Shutdown() is never called.
Expected Behavior
The process can exit and call shutdown functions properly.
Actual Behavior
The process exits immediately.
Proposed Solution
I am guessing Kill() was used because it provides the same behavior between unix and windows. However, I think a combined solution using cmd.Process.Signal(os.Interrupt) and if that returns error, run Kill(). There could also be a timeout when calling Interrupt, in case it hangs.
On Windows, sending os.Interrupt to a process with os.Process.Signal is not implemented; it will return an error instead of sending a signal.
I can try to put together a pull request, but wanted to get feedback first.
To Reproduce
Implement interface server.Server
Use custom server along main app, e.g: app.Serve(customServer, servers.New())
In Start(ctx) listen for ctx.Done or log in Shutdown()
Additional Context
Details
ProductName: macOS
ProductVersion: 13.5.2
BuildVersion: 22G91
-> Go: Checking minimum version requirements
✓ Your version of Go, 1.21.4, meets the minimum requirements.
-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.18.14, meets the minimum requirements.
The text was updated successfully, but these errors were encountered:
Description
Description
When restarting a process, the runner calls cmd.Process.Kill() which immediately kills the process and does not allow it to clean up / shutdown.
This is an issue when using
buffalo dev
on a Buffalo application that runs a custom Server implementation. The custom server implementation has a context passed toStart()
as well as aShutdown()
function. TheStart()
function never receives the context cancellation andShutdown()
is never called.Expected Behavior
The process can exit and call shutdown functions properly.
Actual Behavior
The process exits immediately.
Proposed Solution
I am guessing
Kill()
was used because it provides the same behavior between unix and windows. However, I think a combined solution usingcmd.Process.Signal(os.Interrupt)
and if that returns error, runKill()
. There could also be a timeout when calling Interrupt, in case it hangs.The Signal package states:
I can try to put together a pull request, but wanted to get feedback first.
To Reproduce
app.Serve(customServer, servers.New())
Start(ctx)
listen forctx.Done
or log inShutdown()
Additional Context
Details
The text was updated successfully, but these errors were encountered: