RedisException: Connection refused

Nextcloud version: 23.0.0
Operating system and version: Debian 11
Apache or nginx version: Nginx 1.18.0
PHP version: 7.4.27

After fresh installation on my VPS, push notifications don’t work. Actually no notifications work at all, so we can’t be notified of new chat messages, calendar alerts etc (between browsers on different users).

I have this fatal error on admin logging

Fatal	no app in context	RedisException: Connection refused

    /var/www/hiddendomain/html/cloud/lib/private/RedisFactory.php - line 124:

    Redis->connect()

    /var/www/hiddendomain/html/cloud/lib/private/RedisFactory.php - line 164:

    OC\RedisFactory->create()

    /var/www/hiddendomain/html/cloud/apps/notify_push/lib/AppInfo/Application.php - line 62:

    OC\RedisFactory->getInstance()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 160:

    OCA\NotifyPush\AppInfo\Application->OCA\NotifyPush\AppInfo\{closure}("*** sensiti ... *")

    /var/www/hiddendomain/html/cloud/3rdparty/pimple/pimple/src/Pimple/Container.php - line 118:

    OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}("*** sensiti ... *")

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 127:

    Pimple\Container->offsetGet()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 457:

    OC\AppFramework\Utility\SimpleContainer->query()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 435:

    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 87:

    OC\AppFramework\DependencyInjection\DIContainer->query()

    <<closure>>

    OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}("*** sensiti ... *")

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 106:

    array_map()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 114:

    OC\AppFramework\Utility\SimpleContainer->buildClass()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 131:

    OC\AppFramework\Utility\SimpleContainer->resolve()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 463:

    OC\AppFramework\Utility\SimpleContainer->query()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 435:

    OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Utility/SimpleContainer.php - line 56:

    OC\AppFramework\DependencyInjection\DIContainer->query()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php - line 50:

    OC\AppFramework\Utility\SimpleContainer->get()

    <<closure>>

    OC\AppFramework\Bootstrap\FunctionInjector->OC\AppFramework\Bootstrap\{closure}("*** sensiti ... *")

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php - line 67:

    array_map()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Bootstrap/BootContext.php - line 51:

    OC\AppFramework\Bootstrap\FunctionInjector->injectFn()

    /var/www/hiddendomain/html/cloud/apps/notify_push/lib/AppInfo/Application.php - line 70:

    OC\AppFramework\Bootstrap\BootContext->injectFn()

    /var/www/hiddendomain/html/cloud/lib/private/AppFramework/Bootstrap/Coordinator.php - line 181:

    OCA\NotifyPush\AppInfo\Application->boot()

    /var/www/hiddendomain/html/cloud/lib/private/legacy/OC_App.php - line 206:

    OC\AppFramework\Bootstrap\Coordinator->bootApp()

    /var/www/hiddendomain/html/cloud/lib/private/legacy/OC_App.php - line 140:

    OC_App::loadApp()

    /var/www/hiddendomain/html/cloud/lib/base.php - line 986:

    OC_App::loadApps()

    /var/www/hiddendomain/html/cloud/index.php - line 36:

    OC::handleRequest()

On nextcloud.log i get also this:

{"reqId":"FyXAwFVr061i2f37FFUZ","level":3,"time":"2022-01-23T10:58:00+00:00","remoteAddr":"IP_hidden","user":"admin","app":"PHP","method":"GET","url":"/apps/logreader/poll?lastReqId=2kL4fWSk6aCcp4fRlod8","message":"Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) at Unknown#0","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0","version":"23.0.0.10"}

Please note that i ve disabled OPcache in nextcloud folder so that doesn’t make any sense to me.

config.php doesn’t contain any extra settings.

no relatable error or warning on nginx log too

Notice: I don’t care to use Redis for now, as i can’t figure out how to setup it on Debian, and have no time to search on that, i don’t have Redis installed at all too

Is www-data in the redis group?

cat /etc/group |grep redis:

redis:x:123:www-data

Can you post your config.php file for NC (edit out private data) so to see how you have redis setup?

I don’t have Redis installed on the system, neither any memcache/redis on config.php

<?php
$CONFIG = array (
  'instanceid' => 'ocmnjx5j3zp9',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => 'cloud.***',
  ),
  'datadirectory' => '/var/www/***/html/cloud/data',
  'dbtype' => 'mysql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://cloud.***',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
);

This below is interesting for not having redis installed:
Fatal no app in context RedisException: Connection refused

Some things I am thinking, If you ever did try and install redis then make sure its uninstalled?

apt remove redis-server php-redis

It just seems weird that your system still thinks it’s to use redis - thus the error in the logs. The error sounds like its looking for a redis port to connect to at some point ???

1 Like

Weird, php7.4-redis was installed somehow.
Uninstalled it and this error stopped. Now i get always the following

Zend OPcache can't be temporary enabled (it may be only disabled till the end of request) at Unknown#0

Look here for info on OPcache:

https://www.tecmint.com/install-opcache-in-debian-ubuntu/

I think that you can probably check its configuration in your php.ini according to the article.

I can’t fix that. I checked also this: https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html, my OPcache is properly configured but message is still fulfilling the error log.

1 Like

Thanks, i removed the opcache.enabled = 1 from user.ini into nextcloud folder

1 Like

I have a similar problem. My stack: RPI3, running Raspbian GNU/Linux 10 (buster) with NC23.

config looks like this:

<?php
$CONFIG = array (
  'instanceid' => 'abcdefgh',
  'passwordsalt' => 'abcdefghabcdefghabcdefghi',
  'secret' => 'abcdefghabcdefghabcdefghabcdefghabcdefgh',
  'trusted_domains' => 
  array (
    1 => '192.168.178.65',
    4 => 'localhost',
    5 => '127.0.0.1',
    2 => 'roelie',
    6 => 'roelie.lan',
 ),
  'datadirectory' => '/data/nextcloud/',
  'overwrite.cli.url' => 'https://roelie/',
  'dbtype' => 'mysql',
  'version' => '23.0.2.1',
  'logtimezone' => 'UTC',
  'installed' => true,
  'singleuser' => false,
  'loglevel' => 2,
  'maintenance' => false,
  'theme' => '',
  'mail_smtpdebug' => true,
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  ),
  'updater.release.channel' => 'stable',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbuser' => 'ncadmin',
  'dbpassword' => 'abcdefghabcdefgh',
  'mysql.utf8mb4' => true,
  'jpeg_quality' => '60',
  'mail_sendmailmode' => 'pipe',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'caniupdate',
  ),

  'data-fingerprint' => 'abcdefghi',
  'trashbin_retention_obligation' => '30,60',
  'trusted_proxies' => 
  array (
    11 => '127.0.0.1',
    12 => '::1',
  ),
);

and it get flooded with RedisException: Connection refused fatals in the logfile.
When opening the fatal, they these details:

{"reqId":"YizcWuIe@S1OCuTH98wjmwAAAJA","level":4,"time":"2022-03-12T17:46:03+00:00","remoteAddr":"94.215.219.34","user":"marjan","app":"no app in context","method":"PROPFIND","url":"/remote.php/dav/files/marjan/","message":"Could not boot notify_push: Connection refused","userAgent":"Mozilla/5.0 (Macintosh) mirall/2.3.3 (build 84) (Nextcloud)","version":"23.0.2.1","exception":{"Exception":"RedisException","Message":"Connection refused","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/RedisFactory.php","line":124,"function":"connect","class":"Redis","type":"->","args":["127.0.0.1",6379,0,"",0,0]},{"file":"/var/www/nextcloud/lib/private/RedisFactory.php","line":164,"function":"create","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/nextcloud/apps/notify_push/lib/AppInfo/Application.php","line":62,"function":"getInstance","class":"OC\\RedisFactory","type":"->","args":[]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":160,"function":"OCA\\NotifyPush\\AppInfo\\{closure}","class":"OCA\\NotifyPush\\AppInfo\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":127,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["OCA\\NotifyPush\\Queue\\IQueue"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":457,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\NotifyPush\\Queue\\IQueue"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\NotifyPush\\Queue\\IQueue"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":87,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\NotifyPush\\Queue\\IQueue",true]},{"function":"OC\\AppFramework\\Utility\\{closure}","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":106,"function":"array_map","args":[{"__class__":"Closure"},["*** sensitive parameter replaced ***"]]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":114,"function":"buildClass","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":[{"__class__":"ReflectionClass","name":"OCA\\NotifyPush\\Listener"}]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":131,"function":"resolve","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\NotifyPush\\Listener"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":463,"function":"query","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\NotifyPush\\Listener"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php","line":435,"function":"queryNoFallback","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\NotifyPush\\Listener"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php","line":56,"function":"query","class":"OC\\AppFramework\\DependencyInjection\\DIContainer","type":"->","args":["OCA\\NotifyPush\\Listener"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php","line":50,"function":"get","class":"OC\\AppFramework\\Utility\\SimpleContainer","type":"->","args":["OCA\\NotifyPush\\Listener"]},{"function":"OC\\AppFramework\\Bootstrap\\{closure}","class":"OC\\AppFramework\\Bootstrap\\FunctionInjector","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php","line":67,"function":"array_map","args":[{"__class__":"Closure"},[{"__class__":"ReflectionParameter","name":"eventDispatcher"},"*** sensitive parameter replaced ***",{"__class__":"ReflectionParameter","name":"activityManager"},{"__class__":"ReflectionParameter","name":"notificationManager"}]]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/BootContext.php","line":51,"function":"injectFn","class":"OC\\AppFramework\\Bootstrap\\FunctionInjector","type":"->","args":[[{"__class__":"OCA\\NotifyPush\\AppInfo\\Application"},"attachHooks"]]},{"file":"/var/www/nextcloud/apps/notify_push/lib/AppInfo/Application.php","line":70,"function":"injectFn","class":"OC\\AppFramework\\Bootstrap\\BootContext","type":"->","args":[[{"__class__":"OCA\\NotifyPush\\AppInfo\\Application"},"attachHooks"]]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":181,"function":"boot","class":"OCA\\NotifyPush\\AppInfo\\Application","type":"->","args":[{"__class__":"OC\\AppFramework\\Bootstrap\\BootContext"}]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":206,"function":"bootApp","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->","args":["notify_push"]},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":140,"function":"loadApp","class":"OC_App","type":"::","args":["notify_push"]},{"file":"/var/www/nextcloud/remote.php","line":151,"function":"loadApps","class":"OC_App","type":"::","args":[["filesystem","logging"]]}],"File":"/var/www/nextcloud/lib/private/RedisFactory.php","Line":124,"CustomMessage":"Could not boot notify_push: Connection refused"},"id":"622cdcc34be1b"}

What is happening?

Hello,

You can check my conf, using redis too. Will add my redis.conf to this example directorie…

I was bang’n through NC27 to get this working and it ended up being something too simple.
The redis-server.service was inactive and not enabled to autostart… SMH

systemctl start redis-server.service
systemctl enable redis-server.service

Confirm it’s working with:
redis-cli ping

The response should be PONG.