chaos-mesh / chaosd

A Chaos Engineering toolkit.
Apache License 2.0
132 stars 63 forks source link

Do not fill with the disk and it seems that -c would be ignore #212

Open fbi007130 opened 2 years ago

fbi007130 commented 2 years ago

Bug Report

What version of Kubernetes are you using? kubectl version Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"a9dda44d3f9da886364993e5cbb0f2afbbeae113", GitTreeState:"clean", BuildDate:"2022-02-10T11:38:28Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

What version of Chaos Mesh are you using? /usr/local/chaosd-latest-linux-amd64/chaosd version Chaosd Version: version.Info{GitVersion:"main-g8f5b737967a4c5", GitCommit:"8f5b737967a4c57ed4f9f8b0f9312b9ec73cce6a", BuildDate:"2022-08-17T06:48:40Z", GoVersion:"go1.18.2", Compiler:"gc", Platform:"linux/amd64"}

What did you do? `:~> sudo /usr/local/chaosd-latest-linux-amd64/chaosd attack disk fill -c 100 -f false

:~> [2022/09/05 07:26:56.751 +00:00] [ERROR] [disk.go:48] ["fallocate: fallocate failed: No space left on device\n"] [error="exit status 1"] [stack="github.com/chaos-mesh/chaosd/pkg/server/chaosd.diskAttack.Attack\n\t/w/chaosd/chaosd/pkg/server/chaosd/disk.go:48\ngithub.com/chaos-mesh/chaosd/pkg/server/chaosd.(*Server).ExecuteAttack\n\t/w/chaosd/chaosd/pkg/server/chaosd/attack.go:105\ngithub.com/chaos-mesh/chaosd/cmd/attack.processDiskAttack\n\t/w/chaosd/chaosd/cmd/attack/disk.go:141\nreflect.Value.call\n\t/t/go/1.18.2/x64/src/reflect/value.go:556\nreflect.Value.Call\n\t/t/go/1.18.2/x64/src/reflect/value.go:339\ngo.uber.org/dig.defaultInvoker\n\t/github/home/go/pkg/mod/go.uber.org/dig@v1.14.1/container.go:220\ngo.uber.org/dig.(Scope).Invoke\n\t/github/home/go/pkg/mod/go.uber.org/dig@v1.14.1/invoke.go:92\ngo.uber.org/fx.runInvoke\n\t/github/home/go/pkg/mod/go.uber.org/fx@v1.17.1/invoke.go:93\ngo.uber.org/fx.(module).executeInvoke\n\t/github/home/go/pkg/mod/go.uber.org/fx@v1.17.1/module.go:174\ngo.uber.org/fx.(*module).executeInvokes\n\t/github/home/go/pkg/mod/go.uber.org/fx@v1.17.1/module.go:155\ngo.uber.org/fx.New\n\t/github/home/go/pkg/mod/go.uber.org/fx@v1.17.1/app.go:534\ngithub.com/chaos-mesh/chaosd/pkg/utils.FxNewAppWithoutLog\n\t/w/chaosd/chaosd/pkg/utils/utils.go:27\ngithub.com/chaos-mesh/chaosd/cmd/attack.NewDiskFillCommand.func1\n\t/w/chaosd/chaosd/cmd/attack/disk.go:117\ngithub.com/spf13/cobra.(Command).execute\n\t/github/home/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860\ngithub.com/spf13/cobra.(Command).ExecuteC\n\t/github/home/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974\ngithub.com/spf13/cobra.(*Command).Execute\n\t/github/home/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902\nmain.main\n\t/w/chaosd/chaosd/cmd/main.go:79\nruntime.main\n\t/__t/go/1.18.2/x64/src/runtime/proc.go:250"] Error: exit status 1

[1]+ Exit 1 sudo /usr/local/chaosd-latest-linux-amd64/chaosd attack disk fill -c 100 -f false **What did you expect to see?** /dev/sda3 would be filled up and fallocate might be not display in log. What did you see instead? ``~> df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 67055596 58884936 8170660 88% /

~> ls -lrth total 46G drwxr-xr-x 2 root root 6 May 25 2018 bin -rw-r--r-- 1 root root 39M Sep 2 06:38 chaosd-latest-linux-amd64.tar.gz -rw-r--r-- 1 root root 0 Sep 5 07:26 example2009840103

:~> du -d1 example2009840103 47769308 example2009840103

`` Output of chaosctl

cwen0 commented 1 year ago

@fbi007130 Can you make sure if the target disk has enough space? -c 100 represents chaosd will fill 100 percent of the total size, which requires the disk is empty.

cwen0 commented 1 year ago

In addition, If you want to set -f to false, you can try chaosd attack disk fill -c 100 -f=false

fbi007130 commented 1 year ago

I confirm that the space is enough in the disk.After execution,it still write data in disk.dd also work after chaosd attack while -f is true. Secondly,the disk can be filled via cmd dd.

cwen0 commented 1 year ago

I confirm that the space is enough in the disk.After execution,it still write data in disk.dd also work after chaosd attack while -f is true. Secondly,the disk can be filled via cmd cc.

Can you describe the effect you want to achieve?

fbi007130 commented 1 year ago

I confirm that the space is enough in the disk.After execution,it still write data in disk.dd also work after chaosd attack while -f is true. Secondly,the disk can be filled via cmd cc.

Can you describe the effect you want to achieve?

I want to occupy the disk which is in the worknode and I found that there is issue while fallocate is invoke by chaos-mesh. I find that cmd dd is work in those env. I still want to use cmd fallocate via chaos-mesh because it is spend time less than dd.At the other hand there is a bug in chaos-mesh GUI so that fallocate should not set as false.