Random connection disconnect or loss of authorization ?
Might be related to #6 (closed) but I figured I'd make a new issue. Feel free to close.
Thanks to the SSE Warning feature, I realised my phone was reconnecting every minute and my nextcloud nginx logs were full of "error...upstream timed out" entries. I then changed the config to allow fastcgi timeout of 600s and the warnings disappeared. Nginx logs are also clean of any errors.
After a successful test push yesterday at 1151 UTC, I tried test pushes today at 0746 UTC both of which failed.
Between those times;
- I slept during the night so the phone was idle for long so possible app was killed but nothing in the access logs ?
- Regarding (1), I didn't receive notifications even when I opened the "Push for.." app so (1) is probably not true.
- The wi-fi possibly reconnected. I use an LTE router so connection reconnects are common during night but they are often seamless.
- I rebooted the phone in the morning and can confirm the app starts at boot.
I finally had to "reload service" to get the notifications.
logcat | grep NC- only has entries of ... onFailure ... starting at ~0800 UTC.
05-20 10:00:00.703 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:02.716 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:04.746 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:06.775 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:08.802 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:10.830 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:12.851 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:14.855 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:16.884 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:18.914 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:20.919 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:22.934 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:24.968 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:27.003 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:29.008 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:31.020 4108 20302 D NC-NotificationService: onFailure
05-20 10:00:33.039 4108 21588 D NC-NotificationService: onFailure
05-20 10:00:35.069 4108 20302 D NC-NotificationService: onFailure
## reload service
05-20 10:00:37.457 4108 21588 D NC-NotificationService: onOpen: 200
05-20 10:00:37.459 4108 21588 D NC-NotificationService: New SSE message event=start message=start
05-20 10:00:37.478 4108 4108 D NC-NotificationService: Nextcloud onConnected
nginx access log has only these after 1151 UTC yesterday
172.20.0.6 - - [20/May/2021:04:04:35 +0200] "POST /index.php/apps/ssepush/sse HTTP/1.1" 200 5327 "-" "okhttp/4.9.1" "IP"
172.20.0.6 - - [20/May/2021:07:03:03 +0200] "POST /index.php/apps/ssepush/sse HTTP/1.1" 200 1117 "-" "okhttp/4.9.1" "IP"
<!-- this failed --> 172.20.0.6 - - [20/May/2021:09:46:28 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 118 "-" "Nextcloud Server Crawler" "172.20.0.1"
<!-- force reload --> 172.20.0.6 - user [20/May/2021:09:52:32 +0200] "POST /ocs/v2.php/apps/notifications/api/v2/push?devicePublicKey=-----
172.20.0.6 - admin [20/May/2021:09:52:33 +0200] "POST /ocs/v2.php/apps/notifications/api/v2/push?devicePublicKey=-----
172.20.0.6 - admin [20/May/2021:09:52:33 +0200] "POST /index.php/apps/ssepush/authorize?format=json&
## notifications successful :)
172.20.0.6 - - [20/May/2021:09:52:39 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
172.20.0.6 - - [20/May/2021:09:52:41 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
172.20.0.6 - - [20/May/2021:09:54:04 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
172.20.0.6 - - [20/May/2021:09:54:08 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
172.20.0.6 - - [20/May/2021:09:59:56 +0200] "POST /index.php/apps/ssepush/sse HTTP/1.1" 200 4298 "-" "okhttp/4.9.1" "IP"
172.20.0.6 - - [20/May/2021:10:02:19 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
172.20.0.6 - - [20/May/2021:10:02:22 +0200] "POST /index.php/apps/ssepush/notifications HTTP/1.1" 200 28 "-" "Nextcloud Server Crawler" "172.20.0.1"
What might have happened might be related to a randomly occurring issue (not my post). Sometimes, when the router reconnects to the network, in the meantime, the nextcloud desktop app tries to maintain the connection but sees the routers certificate and signs out and remains so until I do a sign-in from the app so basically it de-authorizes because of a certificate error and I have to reauthorize it again. Hence, why I thought this issue was related to #6 (closed). FYI, the nextcloud android app doesn't seem to have this issue.
When I did a force reload, it automatically reauthorized and everything was fine. That's the only thing I could think of that might have caused the disconnect.
Is there any better way to debug these kinds of issues in the future ?