question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gotify Android client keeps disconnecting

See original GitHub issue

Hi,

I am running latest gotify docker (2.0.21) The relevant docker compose section is:

Docker startup command or config file here (please mask sensitive information)

Docker Compose section

    gotify:
        image: gotify/server:latest
        container_name: gotify
        hostname: gotify
        volumes:
            - /gotify/config:/app/data
        environment:
            - TZ=Europe/Berlin
        networks:
            - gotify
        ports:
            - 8083:80
        restart: unless-stopped

No reverse proxy - my android mobile connects directly to the Ubuntu server running the Gotify docker.

After a few minutes (cant really say how many because sometimes is 3 minutes sometimes is 10m or more) my android client running on Samsung S20 (latest version installed form the App Store) disconnects. It then reconnects again after about 1m.

Here is the error log I see in the Android Gotify App:
2021-01-26T08:54:48.513Z INFO: Entering LogsActivity
2021-01-26T08:54:46.358Z INFO: Loading more messages for -1
2021-01-26T08:54:46.349Z INFO: Entering MessagesActivity
2021-01-26T08:54:45.943Z INFO: WebSocket: scheduling a restart in 60 second(s) (via alarm manager)
2021-01-26T08:54:45.934Z ERROR: WebSocket(46): failure Message:
java.net.SocketException: Software caused connection abort
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
at java.net.SocketInputStream.read(SocketInputStream.java:176)
at java.net.SocketInputStream.read(SocketInputStream.java:144)
at okio.Okio$2.read(Okio.java:140)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
at okio.RealBufferedSource.request(RealBufferedSource.java:68)
at okio.RealBufferedSource.require(RealBufferedSource.java:61)
at okio.RealBufferedSource.readByte(RealBufferedSource.java:74)
at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:117)
at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:101)
at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2021-01-26T08:44:33.867Z INFO: WebSocket(46): opened
2021-01-26T08:44:33.852Z INFO: WebSocket(46): starting...
2021-01-26T08:44:33.851Z INFO: WebSocket(45): closing existing connection.
In the Gotify docker I see this:
[GIN] 2021/01/26 - 16:43:35 | 200 | 1.861066ms | 192.168.0.109 | GET "/message?limit=100&since=0"
[GIN] 2021/01/26 - 16:43:35 | 200 | 287.713µs | 192.168.0.109 | GET "/application"
[GIN] 2021/01/26 - 16:43:42 | 200 | 532.745µs | 192.168.0.109 | GET "/message?limit=10"
[GIN] 2021/01/26 - 16:43:56 | 200 | 54.402µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:44:27 | 200 | 74.13µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:44:33 | 200 | 293.584µs | 192.168.0.109 | GET "/stream?token=XXXXXXXXXXXXXXXXX"
[GIN] 2021/01/26 - 16:44:33 | 200 | 424.421µs | 192.168.0.109 | GET "/message?limit=10"
[GIN] 2021/01/26 - 16:44:57 | 200 | 53.601µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:45:27 | 200 | 88.217µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:45:57 | 200 | 39.675µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:46:27 | 200 | 44.945µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:46:57 | 200 | 35.877µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:47:27 | 200 | 44.333µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:47:57 | 200 | 65.964µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:48:27 | 200 | 31.709µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:48:58 | 200 | 35.858µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:49:28 | 200 | 34.504µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:49:58 | 200 | 39.365µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:50:28 | 200 | 33.314µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:50:58 | 200 | 29.857µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:51:28 | 200 | 42.43µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:51:58 | 200 | 36.889µs | 127.0.0.1 | GET "/health"
[GIN] 2021/01/26 - 16:52:28 | 200 | 42.631µs | 127.0.0.1 | GET "/health"
WebSocket: ReadError read tcp 172.18.0.4:80->192.168.0.109:46576: read: connection reset by peer

Ubuntu Server running the Gotify docker is 192.168.0.172 (no firewall) Gotify Docker is 172.18.0.4 Mobile phone running the Gotify Android app is 192.168.0109

I have tried a few things like adding - GOTIFY_SERVER_KEEPALIVEPERIODSECONDS=60 - GOTIFY_SERVER_STREAM_PINGPERIODSECONDS=60 to the docker compose file but it made no difference.

Battery optimization for Gotify app is disabled.

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:29 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
quthlacommented, Feb 14, 2021

As I said I was using that on 2.0.12 and before and am not using it anymore now after you fixed reconnect yourself.

The issue was that back then it would never reconnect when it took that path so I commented it out as a quick fix. Unfortunately I’m not able to tell you the exact reason as it was more than a year ago when I did that.

https://github.com/quthla/android/commits/4 this is what I’m currently running and it doesn’t contain that commit.

1reaction
biggdaniellcommented, Feb 1, 2021

I have the same issue. The real problem is that it’s not reconnecting automatically (I get that message saying it will try again in 20 minutes but it stays that way). I have to logout from the application and login/re-register it to get it to work again. Also, despite battery optimization/sleeping apps being disabled, I can only get it to work if I allow foreground notifications. Otherwise, as soon as the app is minimized (by pressing the android home button) it’s no longer working (no notifications at all - if I open it again I can see the messages, but no notifications).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gotify - Apps on Google Play
Gotify is a server for sending and receiving messages in real-time per web socket. This app subscribes to the web socket and creates...
Read more >
My open source notification Android app and server can now ...
You basically just use curl -d message server.lan/topic to send messages and you'll receive them on your phone. No fuzz :-D. I should...
Read more >
Gotify - AppGrooves
Great notification client and server application. Sometimes the websocket connection disconnects and doesn't reestablish until I manually focus the app and ...
Read more >
Server disconnexion - Raspberry Pi Forums
It keeps running, but cannot be reached, so the only way out is unplug it and reboot. ... Look at the logs in...
Read more >
gotify - Bountysource
Similar to how the Android app allows you to use absolute time instead of relative, I'd like the same on the web UI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found