-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Client stops responding after a day or so #18
Comments
That's strange because, in the tests, I emulate that time range. Also, you can try to catch any errors and StackTrace with the runZonedGuarded |
I have not tried to run in locally for this long, only few hours and they were not in a stand-by mode as production clients mostly are. Centrifugo config I use is the same for dev and prod environment. I have over 30 clients connected like this and they behave similarly, some last longer, some stop logging stuff and dropping put of presence earlier, it's really weird. I did notice though that one client in particular has issues and I am losing him faster. The client runs on a Windows machine with 3G like speed network while also probably really unstable. Manual restart of thst client brings it back to working state for some time. In which situation would Spinify stop completely logging? The one "zombie" client been running now for 9 hours without connection, still reporting to me with green health status and doing other jobs it needs to do, just no Spinify logs or presence |
This shouldn't happen because at least we should at least have ping/pong messages. And without ping/pong, we should make a reconnection. |
I'll probably make a simple headless flutter application inside a docker container to track that behavior. |
I thought the same, but its happening. Pings just stop and theres no disconnect event/log, whatever, in client's Spinify log. I have not used runZonedGuarded(), well, it didn't occur to me to wrap it, since client is still running and does not seem to be crashing. By the way, I am not using Flutter, it's pure dart cli tool for windows, does that change anything? |
@FluffyDiscord for now try to wrap everything at main with |
Will try. Which logs would you want? I can send you spinify logs tomorrow morning. This is the implementation. Maybe I have something horribly wrong? (Please excuse any syntax errors, its pain to work with code on a phone) var client = Spinify(
config: SpinifyConfig(
client: (name: "client_name", version: version),
getPayload: () async => utf8.encode(jsonEncode(Env.apiToken)),
connectionRetryInterval: (min: Duration(milliseconds: 500), max: Duration(seconds: 5)),
timeout: Duration(minutes: 1),
codec: SpinifyProtobufCodec(),
logger: (level, event, message, _) {
switch(level) {
case 0:
Logger.debug("[WS]: [$event]: $message");
break;
case 1:
Logger.info("[WS]: TRANSPORT [$event]: $message");
break;
case 2:
Logger.info("[WS]: CONFIG [$event]: $message");
break;
case 3:
Logger.info("[WS]: [$event]: $message");
break;
case 4:
Logger.warning("[WS]: [$event]: $message");
break;
case 5:
Logger.error("[WS]: [$event]: $message");
break;
case 6:
Logger.critical("[WS]: [$event]: $message");
break;
default:
Logger.warning("[WS]: Unknown LEVEL $level [$event]: $message");
}
},
),
);
String socketUrl = Env.apiBaseUrl;
await client!.connect("$socketUrl/connection/websocket");
Logger.info("connection open");
String? clientId = client!.subscriptions.server.keys.firstOrNull;
if(clientId == null) {
Logger.emergency("backend did not response with subscription, exiting");
exit(1)
}
client!.subscriptions.server[clientId]!.stream.publication().map((event) => utf8.decode(event.data)).listen((payload) async {
// Do stuff
}); |
Just get the idea, what happened before logs stop occurring. Try it with clean centrifugo entry, not a production one. |
Describe the bug
I have client that I need to keep open connection for months. After a day or so I see that the client stops responding. Spinify does not output ANY logs when this situation happens. On server, client is no longer visible in presence. It's not getting unsubscribed, nor disconnected, because I would be aware of that. It's simply not responding any more. The client program is still running though, because I have a timer inside which sends HTTP requests periodically as a health check, so I know its up and running, just Spinify not connecting to the server.
To Reproduce
Run client for two days
Expected behavior
Keep sending pings
Screenshots
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: