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 during eventsocket reconnect testing #212

Closed
iProdigy opened this issue Feb 6, 2023 · 0 comments · Fixed by #217
Closed

Panic during eventsocket reconnect testing #212

iProdigy opened this issue Feb 6, 2023 · 0 comments · Fixed by #217

Comments

@iProdigy
Copy link

iProdigy commented Feb 6, 2023

Was testing my eventsub websocket reconnect implementation and randomly encountered this panic from the cli (but subsequent testing hasn't reproduced the error):

panic: runtime error: slice bounds out of range [1:0]

goroutine 38 [running]:
github.com/twitchdev/twitch-cli/internal/events/mock_wss_server.onCloseConnection(0x0?, 0xc0001a40f0?)
        /go/src/github.com/twitchdev/twitch-cli/internal/events/mock_wss_server/server.go:243 +0x1ac
github.com/twitchdev/twitch-cli/internal/events/mock_wss_server.eventsubHandle.func4()
        /go/src/github.com/twitchdev/twitch-cli/internal/events/mock_wss_server/server.go:193 +0x208
created by github.com/twitchdev/twitch-cli/internal/events/mock_wss_server.eventsubHandle
        /go/src/github.com/twitchdev/twitch-cli/internal/events/mock_wss_server/server.go:175 +0x838

wsSrv.connections = append(wsSrv.connections[:c], wsSrv.connections[c+1:]...)

 

The other strange thing in the logs is Disconnected websocket repeats multiple times for the same websocket id:

2023/02/05 18:42:00 Starting mock EventSub WebSocket servers on ws://localhost:8080/eventsub (alternate on port 8081)
2023/02/05 18:42:00 `Ctrl + C` to exit mock servers.
2023/02/05 18:42:00 Started alternate EventSub websocket server on port 8081. This one is used for reconnect testing.
2023/02/05 18:42:00 Mock EventSub websocket server started on port 8080
2023/02/05 18:42:20 First client connected; Reconnect testing enabled. Notices will be sent in 30 seconds.
2023/02/05 18:42:20 [Server 0] Connections: (1) [ 93413566-cd0a-5e19-5c22-56b504cc7757 ]
2023/02/05 18:42:50 Terminating server 0 with reconnect notice. Disallowing connections in 30 seconds.
2023/02/05 18:42:50 Server "not accepting connections" status: [Server 0: true, Server 1: false]
2023/02/05 18:42:50 Sent reconnect notice to 93413566-cd0a-5e19-5c22-56b504cc7757
2023/02/05 18:42:50 Reconnect notices sent for server 0
2023/02/05 18:42:50 Use this new URL for connections: ws://localhost:8081/eventsub
2023/02/05 18:42:50 [Server 1] Connections: (1) [ a99cdcd3-d8b1-400b-d3b8-e0adac38de4c ]
2023/02/05 18:42:50 read: websocket: close 1000 (normal)
2023/02/05 18:42:50 Disconnected websocket 93413566-cd0a-5e19-5c22-56b504cc7757
2023/02/05 18:42:50 [Server 0] Connections: (0) [  ]
2023/02/05 18:42:50 Disconnected websocket 93413566-cd0a-5e19-5c22-56b504cc7757
2023/02/05 18:42:50 Disconnected websocket 93413566-cd0a-5e19-5c22-56b504cc7757
@Xemdo Xemdo mentioned this issue Mar 20, 2023
4 tasks
@Xemdo Xemdo linked a pull request Mar 20, 2023 that will close this issue
4 tasks
@Xemdo Xemdo closed this as completed in #217 Apr 1, 2023
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

Successfully merging a pull request may close this issue.

1 participant