UP-NextPush / server-app

UnifiedPush provider for Nextcloud - server application - Moved to https://codeberg.org/NextPush/uppush
GNU Affero General Public License v3.0
67 stars 8 forks source link

RedisException: read error on connection to 127.0.0.1:6379 #10

Closed tacruc closed 1 year ago

tacruc commented 2 years ago

Hey, thanks for your amazing app. I quite regularly get this error in my log. Do you have any idea if it can be fixed, or why my be the issue?

RedisException: read error on connection to 127.0.0.1:6379
    /srv/www/nextcloud/apps/uppush/lib/Controller/UnifiedPushProviderController.php - line 221:
    Redis->brPop("ba493811-d6 ... c", 600)
    /srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217:
    OCA\UnifiedPushProvider\Controller\UnifiedPushProviderController->syncDevice("ba493811-d6 ... c")
    /srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126:
    OC\AppFramework\Http\Dispatcher->executeController(OCA\UnifiedP ... {}, "syncDevice")
    /srv/www/nextcloud/lib/private/AppFramework/App.php - line 157:
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\UnifiedP ... {}, "syncDevice")
    /srv/www/nextcloud/lib/private/Route/Router.php - line 302:
    OC\AppFramework\App::main("OCA\\Unifie ... r", "syncDevice", OC\AppFramew ... {}, { deviceId: ... "})
    /srv/www/nextcloud/lib/base.php - line 1006:
    OC\Route\Router->match("/apps/uppus ... c")
    /srv/www/nextcloud/index.php - line 36:
    OC::handleRequest()
p1gp1g commented 2 years ago

Does it happen when the android app reconnects to the server, for instance when you switch airplane mode off/on ? If so, it is a known issue and need to be fixed. It should not happen too often

tacruc commented 2 years ago

Reconnecting was a good tip. Yesterday, I logged out and back in from the app. At this time the errors in the logs changed to:

[PHP] Fehler: array_key_exists() expects parameter 2 to be array, null given at /srv/www/nextcloud/lib/public/AppFramework/Controller.php#121

GET /index.php/apps/uppush/device/24e31349-2db9-4628-a287-b1df43dbec85
from ::1 at 2022-04-12T09:29:17+02:00
[PHP] Fehler: array_key_exists() expects parameter 2 to be array, null given at /srv/www/nextcloud/lib/public/AppFramework/Controller.php#152

GET /index.php/apps/uppush/device/24e31349-2db9-4628-a287-b1df43dbec85
from ::1 at 2022-04-12T09:29:17+02:00
[index] Fehler: No responder registered for format json!

GET /index.php/apps/uppush/device/24e31349-2db9-4628-a287-b1df43dbec85
from ::1 at 2022-04-12T09:29:17+02:00

This Error can be reproduced by reconnecting (airplane mode on-off). So possibly related to #8.

p1gp1g commented 2 years ago

So, this error is known and can be ignored, unless it happens every x minutes. I've to patch the code to catch the error.

The first one is different then. Any clue when it happens, or how to reproduce it ?

PS: you forgot to redact the device token 24e[...]; You should reconnect on nextpush android.

tacruc commented 2 years ago

PS: you forgot to redact the device token 24e[...]; You should reconnect on nextpush android.

Thanks :+1:

tacruc commented 2 years ago

After relogin I cannot reproduce the issue. I will tell you if it reappears.

tacruc commented 2 years ago

Ok, now the error is back. I assume it is related to the fact, that the Redis service restarted. In detail:

  1. Server Reboot
  2. Redis didn't start due to the wrong start order
  3. Errors in the log that Redis is is down.
  4. After a while started Redis manually

Now the error is back.

p1gp1g commented 2 years ago

It happens when the redis is disconnected or even after the connection is back ?

tacruc commented 2 years ago

Quite regularly after the connection is back.

p1gp1g commented 2 years ago

The problem is probably fixed with the release 1.0.5

DonPicciotto commented 2 years ago

I have this too, or at least it seems pretty similar {"reqId":"10767pQJ5TH2ySaMk78e","level":3,"time":"2022-08-16T17:42:05+02:00","remoteAddr":"192.168.1.249","user":"--","app":"index","method":"GET","url":"/index.php/apps/uppush/device/48c4631d-93a5-4df9-869c-bde7d2f3cf7e","message":"read error on connection to /var/run/redis/redis-server.sock:0","userAgent":"okhttp/4.9.3","version":"24.0.4.1","exception":{"Exception":"RedisException","Message":"read error on connection to /var/run/redis/redis-server.sock:0","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/uppush/lib/Controller/UnifiedPushProviderController.php","line":218,"function":"brPop","class":"Redis","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"syncDevice","class":"OCA\\UnifiedPushProvider\\Controller\\UnifiedPushProviderController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/uppush/lib/Controller/UnifiedPushProviderController.php","Line":218,"CustomMessage":"--"}}

p1gp1g commented 2 years ago

@DonPicciotto : Which version of nextpush server do you use ? Were you able to reproduce this bug ?

DonPicciotto commented 2 years ago

@DonPicciotto : Which version of nextpush server do you use ? Were you able to reproduce this bug ?

Yep, still have this in log 2022-08-19T10:17:46 UTC

    RedisException: read error on connection to /var/run/redis/redis-server.sock:0

    /var/www/nextcloud/apps/uppush/lib/Controller/UnifiedPushProviderController.php - line 218:

    Redis->brPop()

I use latest nextpush version from the store

DonPicciotto commented 2 years ago

Oh, wait, maybe I'm just really dumb. I deleted the block "location /_matrix/push/v1/notify" in nginx and the error is gone (until now). Maybe the problem was that since... I have nextcloud on standard port 80/443

DonPicciotto commented 1 year ago

It started again, sadly, even without matrix lines

[index] Errore: RedisException: read error on connection to /var/run/redis/redis-server.sock:0 at <<closure>>

0. /var/www/nextcloud/apps/uppush/lib/Controller/UnifiedPushProviderController.php line 199
   Redis->brPop()
1. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225
   OCA\UnifiedPushProvider\Controller\UnifiedPushProviderController->syncDevice()
2. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133
   OC\AppFramework\Http\Dispatcher->executeController()
3. /var/www/nextcloud/lib/private/AppFramework/App.php line 172
   OC\AppFramework\Http\Dispatcher->dispatch()
4. /var/www/nextcloud/lib/private/Route/Router.php line 298
   OC\AppFramework\App::main()
5. /var/www/nextcloud/lib/base.php line 1023
   OC\Route\Router->match()
6. /var/www/nextcloud/index.php line 36
   OC::handleRequest()

GET /index.php/apps/uppush/device/83............ 
p1gp1g commented 1 year ago

Fixed with 1.1.1