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
Describe the bug
When calling the RunTask with a long running task def after Close, the task gets cancelled.
To Reproduce
Use the samples/slog example and add another manager.Close() call after the existing Close call and immediately after add manager.RunTask(ctx, def). The task is executed and killed after a moment.
Expected behavior
One possible solution is to forbid execution of tasks after the manager has been closed (this is a similar philosophy as for other Go Close methods, for example closing a request's body (io.ReadCloser) also does not allow to read from the body anymore (closed socket). I would imagine a lot of people will expect such behavior from a Close method.
If you don't want this kind of behavior, I would consider renaming the method to Stop instead and resolve the race condition.
The text was updated successfully, but these errors were encountered:
Describe the bug
When calling the
RunTask
with a long running task def afterClose
, the task gets cancelled.To Reproduce
Use the
samples/slog
example and add anothermanager.Close()
call after the existingClose
call and immediately after addmanager.RunTask(ctx, def)
. The task is executed and killed after a moment.Expected behavior
One possible solution is to forbid execution of tasks after the manager has been closed (this is a similar philosophy as for other Go
Close
methods, for example closing a request's body (io.ReadCloser
) also does not allow to read from the body anymore (closed socket). I would imagine a lot of people will expect such behavior from aClose
method.If you don't want this kind of behavior, I would consider renaming the method to
Stop
instead and resolve the race condition.The text was updated successfully, but these errors were encountered: