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

Daemon tests fail with nil pointer panic when run twice #282

Closed
benhoyt opened this issue Aug 18, 2023 · 1 comment · Fixed by #491
Closed

Daemon tests fail with nil pointer panic when run twice #282

benhoyt opened this issue Aug 18, 2023 · 1 comment · Fixed by #491
Labels
Tests Test failures (usually intermittent)

Comments

@benhoyt
Copy link
Contributor

benhoyt commented Aug 18, 2023

If you run the daemon package's tests twice in a row with -count=2, like so:

go test -count=2 -v ./internals/daemon -check.v

The following failure occurs (reliably as far as I can tell):

START: daemon_test.go:98: daemonSuite.TestAddCommand
START: daemon_test.go:61: daemonSuite.SetUpTest
PASS: daemon_test.go:61: daemonSuite.SetUpTest	0.000s

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=0x28 pc=0x79f42d]

goroutine 1940 [running]:
net/http.(*onceCloseListener).close(...)
	/home/ben/sdk/go1.20.6/src/net/http/server.go:3501
sync.(*Once).doSlow(0xc00019efa8?, 0xc000169c18?)
	/home/ben/sdk/go1.20.6/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
	/home/ben/sdk/go1.20.6/src/sync/once.go:65
net/http.(*onceCloseListener).Close(0xc000223920?)
	/home/ben/sdk/go1.20.6/src/net/http/server.go:3497 +0x4a
panic({0x936020, 0xd7d7a0})
	/home/ben/sdk/go1.20.6/src/runtime/panic.go:884 +0x213
net/http.(*onceCloseListener).Accept(0xa88ef8?)
	<autogenerated>:1 +0x24
net/http.(*Server).Serve(0xc00019ef00, {0x0, 0x0})
	/home/ben/sdk/go1.20.6/src/net/http/server.go:3059 +0x385
github.com/canonical/pebble/internals/daemon.(*Daemon).Start.func1()
	/home/ben/w/pebble/internals/daemon/daemon.go:490 +0x93
gopkg.in/tomb%2ev2.(*Tomb).run(0xc0004a46f8, 0xc0003ec600?)
	/home/ben/go/pkg/mod/gopkg.in/[email protected]/tomb.go:163 +0x36
created by gopkg.in/tomb%2ev2.(*Tomb).Go
	/home/ben/go/pkg/mod/gopkg.in/[email protected]/tomb.go:159 +0xee
FAIL	github.com/canonical/pebble/internals/daemon	10.135s

It probably means we still have something wrong with our Close logic (see also #253).

I've spent enough time on fixing test failures today, so opening this to track if someone has some time on a rainy day.

@benhoyt benhoyt added the Tests Test failures (usually intermittent) label Aug 18, 2023
@barrettj12
Copy link
Contributor

@aliamerj if you really want to sink your teeth into Pebble, you can dig into this issue, or some of the other intermittent test failures we're seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tests Test failures (usually intermittent)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants