Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on exiting already removed running container #5488

Open
baryluk opened this issue Apr 24, 2024 · 1 comment
Open

Panic on exiting already removed running container #5488

baryluk opened this issue Apr 24, 2024 · 1 comment

Comments

@baryluk
Copy link

baryluk commented Apr 24, 2024

user@debian:~$ buildah version
Version:         1.33.7
Go Version:      go1.22.1
Image Spec:      1.1.0-rc.5
Runtime Spec:    1.1.0
CNI Spec:        1.0.0
libcni Version:  
image Version:   5.29.2
Git Commit:      
Built:           Thu Jan  1 00:00:00 1970
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64
user@debian:~$ 

I built an example container using Dockerfile and code from docker tutorial (it does not matter what you run), https://docs.docker.com/get-started/02_our_app/

user@debian:~/bah/getting-started-app$ buildah build --format docker --squash .
...

Then create a container out of it, and run in it

user@debian:~/bah/getting-started-app$ buildah from --name foobar a1533f4810fc
foobar
user@debian:~/bah/getting-started-app$ buildah run -t foobar /bin/sh
/app # 
/app # 
/app # ps axu
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh
    7 root      0:00 ps axu

Then in a separate terminal, destroy it:

user@debian:~$ buildah ps
CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
ae234bf1bc33     *                  scratch                          working-container
a82746c32f98     *     2ecd1756029a registry.fedoraproject.org/fe... fedora-working-container
1e963ea3f012     *     a1533f4810fc                                  foobar
user@debian:~$ buildah rm 1e963ea3f012
1e963ea3f012144beab41df877d1e1d7e13e3371075d00e11d8dccfa619bd6ba
user@debian:~$ 

Then continue in the container, and try to exit it:

/app #   Ctrl-D
panic: runtime error: invalid memory address or nil pointer dereference
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2c pc=0x828cdc]

goroutine 1 [running]:
github.com/sirupsen/logrus.(*Logger).level(...)
	github.com/sirupsen/logrus/logger.go:358
github.com/sirupsen/logrus.(*Logger).IsLevelEnabled(...)
	github.com/sirupsen/logrus/logger.go:380
github.com/sirupsen/logrus.(*Logger).Logf(0xc000294e08?, 0x0?, {0x1247c53?, 0xc0000061c0?}, {0xc0004c24b8?, 0x444306?, 0xc0004c2b98?})
	github.com/sirupsen/logrus/logger.go:152 +0x1c
github.com/sirupsen/logrus.(*Logger).Errorf(...)
	github.com/sirupsen/logrus/logger.go:186
github.com/containers/buildah.(*Builder).Run.func2()
	github.com/containers/buildah/run_linux.go:141 +0x6f
panic({0x10babe0?, 0x1b958c0?})
	runtime/panic.go:770 +0x132
github.com/sirupsen/logrus.(*Logger).level(...)
	github.com/sirupsen/logrus/logger.go:358
github.com/sirupsen/logrus.(*Logger).IsLevelEnabled(...)
	github.com/sirupsen/logrus/logger.go:380
github.com/sirupsen/logrus.(*Logger).Logf(0xc000294e08?, 0x0?, {0x1249d1c?, 0x7a?}, {0xc0004c2678?, 0x444306?, 0xc0004c2b68?})
	github.com/sirupsen/logrus/logger.go:152 +0x1c
github.com/sirupsen/logrus.(*Logger).Errorf(...)
	github.com/sirupsen/logrus/logger.go:186
github.com/containers/buildah.(*Builder).Run.func3()
	github.com/containers/buildah/run_linux.go:353 +0x7d
github.com/containers/buildah.(*Builder).Run(_, {_, _, _}, {0x0, {0x0, 0x0}, 0x3, {0x122160a, 0x4}, ...})
	github.com/containers/buildah/run_linux.go:379 +0x2e8f
main.runCmd(_, {_, _, _}, {0x0, {0x1cc6e40, 0x0, 0x0}, {0x1cc6e40, 0x0, ...}, ...})
	github.com/containers/buildah/cmd/buildah/run.go:185 +0x9b8
main.init.23.func1(0xc000256300?, {0xc0002201e0?, 0x4?, 0x122150a?})
	github.com/containers/buildah/cmd/buildah/run.go:53 +0x7b
github.com/spf13/cobra.(*Command).execute(0xc00024a908, {0xc000220180, 0x3, 0x3})
	github.com/spf13/cobra/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x1bb6b60)
	github.com/spf13/cobra/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra/command.go:1039
main.main()
	github.com/containers/buildah/cmd/buildah/main.go:235 +0x48
user@debian:~/bah/getting-started-app$ 

Not great.

I am also surprised that me doing buildah rm ... didn't kill the container in the first place. I was still able to do everything in the container, like nothing happened. All files, mounts and binaries where there.

@rhatdan
Copy link
Member

rhatdan commented Apr 25, 2024

Yes buildah rm should have been prevented from a running container.

@nalind WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants