litmus icon indicating copy to clipboard operation
litmus copied to clipboard

pod_network_* can not be destroyed after the experiment finished

Open neWs1587 opened this issue 3 years ago • 2 comments

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
}

neWs1587 avatar Mar 28 '22 05:03 neWs1587

cc: @uditgaurav

ksatchit avatar Mar 28 '22 05:03 ksatchit

Thanks @neWs1587 for opening this issue.

uditgaurav avatar Mar 30 '22 08:03 uditgaurav