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
out.WarningT(`"{{.command}}" is taking longer than expected. This may indicate {{.name}} is hanging.`, out.V{"command": rr.Command(), "name": actualBinaryName})
236
+
case"rm", "remove":
237
+
out.WarningT(`"{{.command}}" is taking longer than expected. Container may be stuck - please be patient.`, out.V{"command": rr.Command()})
238
+
case"volume":
239
+
out.WarningT(`"{{.command}}" is taking longer than expected. Volume operations can be slow.`, out.V{"command": rr.Command()})
240
+
case"network":
241
+
out.WarningT(`"{{.command}}" is taking longer than expected. Network cleanup can be slow.`, out.V{"command": rr.Command()})
242
+
case"prune":
243
+
out.WarningT(`"{{.command}}" is taking longer than expected. Prune operations can take several minutes.`, out.V{"command": rr.Command()})
244
+
default:
245
+
out.WarningT(`"{{.command}}" is taking an unusually long time to respond, please be patient.`, out.V{"command": rr.Command()})
246
+
}
247
+
} else {
248
+
out.WarningT(`"{{.command}}" is taking an unusually long time to respond, please be patient.`, out.V{"command": rr.Command()})
249
+
}
250
+
251
+
// Show restart hint using the actual binary name
252
+
out.ErrT(style.Tip, `If this continues to hang, consider restarting the {{.name}} service.`, out.V{"name": actualBinaryName})
253
+
} else {
254
+
warnLock.Unlock()
201
255
}
202
-
}
256
+
})
203
257
}
204
258
205
-
ifctx.Err() ==context.DeadlineExceeded {
206
-
returnrr, context.DeadlineExceeded
259
+
// Wait for completion or timeout
260
+
select {
261
+
caseerr=<-done:
262
+
// Command completed normally
263
+
ifwarnTimer!=nil {
264
+
warnTimer.Stop()
265
+
}
266
+
case<-ctx.Done():
267
+
// Command timed out
268
+
ifwarnTimer!=nil {
269
+
warnTimer.Stop()
270
+
}
271
+
272
+
// Kill the process if it's still running
273
+
ifcmdWithCtx.Process!=nil {
274
+
klog.Warningf("Killing slow %s process after %v timeout", rr.Command(), killTime)
275
+
cmdWithCtx.Process.Kill()
276
+
}
277
+
278
+
out.WarningT(`"{{.command}}" took too long to respond (>{{.duration}}) and was terminated.`, out.V{"command": rr.Command(), "duration": killTime})
279
+
out.ErrT(style.Tip, `Consider restarting the {{.name}} service if this problem persists.`, out.V{"name": actualBinaryName})
280
+
281
+
returnrr, fmt.Errorf("command timed out after %v: %s", killTime, rr.Command())
207
282
}
283
+
} else {
284
+
// Run without timeout for non-critical operations
285
+
err=cmd.Run()
208
286
}
209
287
288
+
elapsed:=time.Since(start)
289
+
290
+
// Log completion information
210
291
ifex, ok:=err.(*exec.ExitError); ok {
211
292
klog.Warningf("%s returned with exit code %d", rr.Command(), ex.ExitCode())
0 commit comments