Open TheThing opened 4 years ago
I think I found the issue, it seems to be an issue with running the software in docker. Running it on the host machine keeps the connection stable.
I'm wondering if I should re-open this ticket cause the way the onConnection is working and reconnect is very wrong and triggers a lot of error in case there are legitimate connection problems.
I'm submitting a ... [x] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
Summary
For some reason there is a lot of disconnecting and connecting going on when I connect the client to my casparcg 2.2.0 server. It keeps calling onConnected = true before a timeout is immediately triggered and the connection is disposed and a new connection is created, calling onConnected again.
For debugging, I added a unique id to CasparCGSocket for every new socket that gets created so I can keep better track of each socket. I also added a logger into _createNewSocket in CasparCG.js for every time a socket gets disposed as well as the id for that socket that's getting disposed, every time
CasparCGSocketStatusEvent.STATUS
gets listened and whenever _onSocketStatusChange gets called.In addition I added so whenever the connection is onConnected, it calls info:
During opening of the application it "kinda looks normal":
Then if I leave it running doing absolutely nothing, weird thing starts to happen. IT seems to immediately lose connection, reconnect, then dispose then reconnect again.
Notice the timestamp, this all happens in the same second, all these events.
Also notice that socket id 1002
06:15:01.626Z INFO caspar: onConnected status: true, checking if playing by sending info request to socket 1002
never finishes and instead I get onError triggered from that.I have no idea what's going on but it seems that _onSocketStatusChange gets called three times in quick succession leading to the connection being disposed out of nowhere and triggered a new connection being connected every few minutes or so.
Update: In short, _onSocketStatusChange gets called three times on the same socket connection in almost the same millisecond before it disposes that socket connection and creates a brand new one. This seems to happen every 6 - 7 minutes on the dot.