Skip to content

Commit

Permalink
Add wait time into xtables lock warning
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Telfer <ctelfer@docker.com>
  • Loading branch information
ctelfer committed Apr 26, 2018
1 parent 9605f3c commit 36847dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions iptables/iptables.go
Expand Up @@ -430,8 +430,9 @@ const opWarnTime = 2 * time.Second

func filterOutput(start time.Time, output []byte, args ...string) []byte {
// Flag operations that have taken a long time to complete
if time.Since(start) > opWarnTime {
logrus.Warnf("xtables contention detected while running [%s]: %q", strings.Join(args, " "), string(output))
opTime := time.Since(start)
if opTime > opWarnTime {
logrus.Warnf("xtables contention detected while running [%s]: Waited for %.2f seconds and received %q", strings.Join(args, " "), float64(opTime)/float64(time.Second), string(output))
}
// ignore iptables' message about xtables lock:
// it is a warning, not an error.
Expand Down

0 comments on commit 36847dd

Please sign in to comment.