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

Test for plugins/inputs/riemann_listener fails with go 1.16 with unexpected call to os.Exit(0) during test #8888

Closed
sergiodj opened this issue Feb 20, 2021 · 2 comments · Fixed by #8882
Assignees
Labels
bug unexpected problem or unintended behavior

Comments

@sergiodj
Copy link

System info:

I'm testing telegraf 1.17.2 on Ubuntu Hirsute (development release) with golang-go 1.16.

Steps to reproduce:

Basically, build telegraf and the run its testsuite.

Expected behavior:

Everything should pass, as usual.

Actual behavior:

I started seeing the following failure:

2021/02/20 05:27:33 Entering
2021/02/20 05:27:33 I! [] Listening on tcp://127.0.0.1:5555
--- FAIL: TestSocketListener_tcp (0.00s)
panic: unexpected call to os.Exit(0) during test [recovered]
	panic: unexpected call to os.Exit(0) during test

goroutine 6 [running]:
testing.tRunner.func1.2(0x8502e0, 0x94c2c0)
	/usr/lib/go-1.16/src/testing/testing.go:1144 +0x332
testing.tRunner.func1(0xc000001b00)
	/usr/lib/go-1.16/src/testing/testing.go:1147 +0x4b6
panic(0x8502e0, 0x94c2c0)
	/usr/lib/go-1.16/src/runtime/panic.go:965 +0x1b9
os.Exit(0x0)
	/usr/lib/go-1.16/src/os/proc.go:68 +0x6d
github.com/influxdata/telegraf/plugins/inputs/riemann_listener.(*RiemannSocketListener).Stop(0xc0001a8000)
	/<<BUILDDIR>>/telegraf-1.17.2+ds1/plugins/inputs/riemann_listener/riemann_listener.go:390 +0x65
github.com/influxdata/telegraf/plugins/inputs/riemann_listener.TestSocketListener_tcp(0xc000001b00)
	/<<BUILDDIR>>/telegraf-1.17.2+ds1/plugins/inputs/riemann_listener/riemann_listener_test.go:30 +0x1b8
testing.tRunner(0xc000001b00, 0x8ef9b8)
	/usr/lib/go-1.16/src/testing/testing.go:1194 +0xef
created by testing.(*T).Run
	/usr/lib/go-1.16/src/testing/testing.go:1239 +0x2b3
FAIL	github.com/influxdata/telegraf/plugins/inputs/riemann_listener	0.043s

This seems to happen because of https://tip.golang.org/doc/go1.16#go-test. There's a similar issue (with the corresponding PR) here: posener/complete#132

@sergiodj sergiodj added the bug unexpected problem or unintended behavior label Feb 20, 2021
@srebhan
Copy link
Member

srebhan commented Feb 22, 2021

I'm pretty sure this is an actual case! Looking at rieman_listener's Stop() function

func (rsl *RiemannSocketListener) Stop() {
	rsl.wg.Done()
	rsl.wg.Wait()
	os.Exit(0)
}

I rather have to hold my breath... :-S We need to fix it...

@srebhan srebhan assigned srebhan and unassigned srebhan Feb 22, 2021
@sspaink
Copy link
Contributor

sspaink commented Mar 1, 2021

Ok I removed os.Exit(0) call in #8882, I think just removing it should be fine doesn't look like it needs any extra steps.

@sspaink sspaink self-assigned this Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants