Jellyfin Forum
Periodically request sent to server - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Periodically request sent to server (/t-periodically-request-sent-to-server)



Periodically request sent to server - Stoufiler - 2023-11-14

Hello,
I am developing a tool that allows me to wake up my server as soon as a call is made to the domain exhibiting Jellyfin
My program works fine, however I noticed that every hour my server wakes up.
By looking at the logs, we can see that calls are made on:

Code:
/Users/Me
/Branding/Configuration


Logs :
Code:
[13/Nov/2023:20:49:23 +0100] - - 499 - GET https jellyfin.mydomain.com "/Branding/Configuration" [Client xx.xx.xx.xxx] [Length 0] [Gzip -] [Sent-to 192.168.0.24] "Ktor client" "-"
[13/Nov/2023:20:49:53 +0100] - - 499 - GET https jellyfin.mydomain.com "/Users/Me" [Client xx.xx.xx.xxx] [Length 0] [Gzip -] [Sent-to 192.168.0.24] "Ktor client" "-"

[13/Nov/2023:21:49:24 +0100] - - 499 - GET https jellyfin.mydomain.com "/Branding/Configuration" [Client xx.xx.xx.xxx] [Length 0] [Gzip -] [Sent-to 192.168.0.24] "Ktor client" "-"
[13/Nov/2023:21:49:54 +0100] - - 499 - GET https jellyfin.mydomain.com "/Users/Me" [Client xx.xx.xx.xxx] [Length 0] [Gzip -] [Sent-to 192.168.0.24] "Ktor client" "-"

The call is made from the Jellyfin application on Fire TV even if it is on standby
Could you explain to me why this recurrence?
Why only on these two endpoints?
Thanks


RE: Periodically request sent to server - niels - 2023-11-15

The "/Branding/Configuration" endpoint is called when the app is opened to refresh server information. The "/Users/Me" endpoint is called when the user signs in and when background data is updated. So both calls are completely normal when using the app.


RE: Periodically request sent to server - Stoufiler - 2023-11-15

Thanks but call are made even if Fire TV is shutdown

It's only happen on Fire TV. I've installed SwiftFin on my phone and don't have these recurring call every hour.

Maybe it can be the Fire TV itself which call the JellyFin app every hour ?

I don't have any other Android TV hardware so I cannot tell if it's only Fire TV or all Android TV

I've an Android phone. I will check if it's calling every hour on it and let you informed


RE: Periodically request sent to server - niels - 2023-11-15

Fire TV is Android TV with the exact same app. The background synchronization shouldn't happen on Fire TV though so this behavior is likely because the app is somehow opened by the system. You'd need to share client logs (via ADB) to give us a better understanding of what is happening.


RE: Periodically request sent to server - Stoufiler - 2023-11-15

Got some informations about the wake up :

JellyFin is reconnecting on my server when websocket fail

As you can see at 18:58:39 websocket sent and received informations (my server was up)
Code:
11-15 18:58:39.919  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 18:58:39.926  8683  9081 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"KeepAlive","MessageId":"f1b49e0128ba4fee986263c99a23451f"}

At 18:59 my server hibernate so WebSocket is sending every 30 seconds but got no reply :
Code:
11-15 18:59:40.006  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:00:10.050  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}

Until 19:15:08 where Websocket failed and throw an error :
Code:
11-15 19:14:41.107  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: WebSocket has failed
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: java.io.EOFException
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okio.RealBufferedSource.require(RealBufferedSource.kt:199)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okio.RealBufferedSource.readByte(RealBufferedSource.kt:209)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
11-15 19:15:08.643  8683  9081 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: at java.lang.Thread.run(Thread.java:764)
11-15 19:15:08.651  8683  9174 I org.jellyfin.sdk.api.sockets.helper.ReconnectHelper: Reconnect scheduled in 30s (error=true)
11-15 19:15:11.150  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:15:11.150  8683  9174 W org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Unable to send message: invalid state (state=ERROR)
11-15 19:15:38.693  8683  9174 D org.jellyfin.sdk.api.sockets.SocketInstance: Reconnect requested
11-15 19:15:38.694  8683  9174 I org.jellyfin.sdk.api.sockets.SocketInstance: Reconnecting
11-15 19:15:38.697  8683  9174 D org.jellyfin.sdk.api.sockets.helper.ReconnectHelper: Notified about reconnect, attempts=1

On my app we can see that Jellyfin app sent HTTP request to /socket at 19:15
Code:
time="2023-11-15T19:15:40Z" level=info client="172.30.33.5:43196" forwardedFor=<my-external-ip> method=GET path=/socket
time="2023-11-15T19:15:40Z" level=info msg="Server is offline, trying to wake up using Wake On Lan"
time="2023-11-15T19:15:40Z" level=info msg="Magic packet sent"
time="2023-11-15T19:15:46Z" level=info msg="Waiting for server to wake up..."

At 19:16 Server is up and websocket is working again :
Code:
11-15 19:16:38.836  8683  8972 D org.jellyfin.sdk.api.sockets.helper.ReconnectHelper: Notified about reconnect, attempts=2
11-15 19:16:38.946  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: WebSocket has opened
11-15 19:16:38.947  8683  8972 D org.jellyfin.sdk.api.sockets.helper.ReconnectHelper: Notified about connect, attempts reset
11-15 19:16:38.947  8683  8720 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:16:38.971  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"ForceKeepAlive","MessageId":"00000000000000000000000000000000","Data":60}
11-15 19:16:38.972  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"KeepAlive","MessageId":"fa2a7c95f57a4f7ca184777b59029c4a"}
11-15 19:16:38.975  8683  8720 I org.jellyfin.sdk.api.sockets.helper.KeepAliveHelper: Using a KeepAlive message delay of 30 seconds
11-15 19:16:38.976  8683  8740 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:16:38.980  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"KeepAlive","MessageId":"c51f483e442f474a961727244e446066"}
11-15 19:17:09.009  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:17:09.016  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"KeepAlive","MessageId":"1015bab14fcb463797981acb8214f4c3"}
11-15 19:17:39.042  8683  9174 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Sending (raw) message {"MessageType":"KeepAlive","Data":{}}
11-15 19:17:39.049  8683 10490 I org.jellyfin.sdk.api.sockets.OkHttpWebsocketSession: Receiving (raw) message {"MessageType":"KeepAlive","MessageId":"27e03c98ce3640abac8d23ac14900189"}

I continue to fetch logs and come back to you as soon I've something more interesting

Thanks