mirror of
https://github.com/moby/buildkit.git
synced 2025-08-08 10:02:07 +03:00
improve stacks of cancels from defers
In this case the current stack trace points to the line where the context was created. Instead the stack should be captured when the defer is running so the return path to the defer call is also part of the stack. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -143,7 +143,7 @@ func (ls *localSourceHandler) Snapshot(ctx context.Context, g session.Group) (ca
|
||||
|
||||
timeoutCtx, cancel := context.WithCancelCause(ctx)
|
||||
timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded))
|
||||
defer cancel(errors.WithStack(context.Canceled))
|
||||
defer func() { cancel(errors.WithStack(context.Canceled)) }()
|
||||
|
||||
caller, err := ls.sm.Get(timeoutCtx, sessionID, false)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user