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 when consuming a (big) notification 2.0 backlog #381

Closed
ButKor opened this issue May 31, 2024 · 1 comment · Fixed by reubenmiller/go-c8y#64 or #382
Closed

Panic when consuming a (big) notification 2.0 backlog #381

ButKor opened this issue May 31, 2024 · 1 comment · Fixed by reubenmiller/go-c8y#64 or #382

Comments

@ButKor
Copy link

ButKor commented May 31, 2024

I've consumed a Notification 2.0 backlog of ~ 150k messages via: c8y notification2 subscriptions subscribe --name {my subscription name} --subscriber {subscriber name}.

After ~ 100k messages this panic got thrown:

panic: concurrent write to websocket connection
 
goroutine 1 [running]:
github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc0007845a0, 0x1, {0x0?, 0x0?, 0x0?})
	github.com/gorilla/[email protected]/conn.go:632 +0x4b8
github.com/gorilla/websocket.(*messageWriter).Close(0xa3d7d8?)
	github.com/gorilla/[email protected]/conn.go:746 +0x35
github.com/gorilla/websocket.(*Conn).beginMessage(0xc000737ce0, 0xc00081e840, 0x1)
	github.com/gorilla/[email protected]/conn.go:493 +0x47
github.com/gorilla/websocket.(*Conn).NextWriter(0xc000737ce0, 0x1)
	github.com/gorilla/[email protected]/conn.go:535 +0x3f
github.com/gorilla/websocket.(*Conn).WriteMessage(0xc18e9a9c60b784d0?, 0x29f87f4050?, {0xc0002bc000, 0x10, 0x1000})
	github.com/gorilla/[email protected]/conn.go:788 +0x137
github.com/reubenmiller/go-c8y/pkg/c8y/notification2.(*Notification2Client).SendMessageAck(0xc000134b00, {0xc0002bc000, 0x10, 0x1000})
	github.com/reubenmiller/[email protected]/pkg/c8y/notification2/notification2.go:388 +0x113
github.com/reubenmiller/go-c8y-cli/v2/pkg/cmd/notification2/subscriptions/subscribe.(*SubscribeCmd).RunE(0xc0002e1cb0, 0xc0004cbb08, {0x0?, 0x0?, 0x0?})
	github.com/reubenmiller/go-c8y-cli/v2/pkg/cmd/notification2/subscriptions/subscribe/subscribe.manual.go:175 +0x6fc
github.com/reubenmiller/go-c8y-cli/v2/pkg/cmd/notification2/subscriptions/subscribe.NewSubscribeCmd.NewSubCommand.func4(0xc0004cbb08, {0xc0005bfb00, 0x0, 0x4})
	gith:55 +0x62
github.com/spf13/cobra.(*Command).execute(0xc0004cbb08, {0xc0005bfac0, 0x4, 0x4})
	github.com/spf13/[email protected]/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002e8308)
	github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:1039
github.com/reubenmiller/go-c8y-cli/v2/pkg/cmd.MainRun()
	github.com/reubenmiller/go-c8y-cli/v2/pkg/cmd/cmd.go:124 +0x1d0
main.main()
	./main.go:8 +0xf

When restarting the subscription, the rest of the backlog was consumed fine. Not sure if there is something to "fix", but I guess the panic should be handled to e.g. show a proper error message and maybe even retry after some time?

@reubenmiller
Copy link
Owner

reubenmiller commented Jun 1, 2024

Fixed in v2.41.1

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