litmus
litmus copied to clipboard
pod_network_* can not be destroyed after the experiment finished
What happened: I performed an experiment of pod_network_loss on NETWORKINTERFACE eth2. After the step of revert-chaos, the related qdisc was not be removed, and package loss still exists. There's a bug in the kill netem.
Anything else we need to know?:
As we can see in the code sudo nsenter -t %d -n tc qdisc delete dev eth0 root, it will just work on eth0. The NETWORKINTERFACE should be represented by a parameter rather than a solid value eth0.
https://github.com/litmuschaos/litmus-go/blob/37130c3556911bab1666899c0e8c5541d14eaf6a/chaoslib/litmus/network-chaos/helper/netem.go
func killnetem(PID int) error {
tc := fmt.Sprintf("sudo nsenter -t %d -n tc qdisc delete dev eth0 root", PID)
cmd := exec.Command("/bin/bash", "-c", tc)
out, err := cmd.CombinedOutput()
log.Info(cmd.String())
if err != nil {
log.Error(string(out))
// ignoring err if qdisc process doesn't exist inside the target container
if strings.Contains(string(out), qdiscNotFound) || strings.Contains(string(out), qdiscNoFileFound) {
log.Warn("The network chaos process has already been removed")
return nil
}
return err
}
return nil
}
cc: @uditgaurav
Thanks @neWs1587 for opening this issue.