Inexplicable Redis Error Identification NC 24

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 24.0.1
Operating system and version (eg, Ubuntu 20.04): ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.4): 7.4-fpm

The issue you are facing:

Can someone help me identify the cause of the following Redis / Memcache error(s) (they are all the same error: 1. From my custom error log, 2. Formatted from admin/logging 3. Raw from admin/logging.

I do not have errors in my redis log. And I get “All Checks Passed” in Overview. And my nc config.php has Redis configured correctly, see below:

My Log

{"reqId":"YpbPzhecaMVAckJHTW5oNwAAAAM","level":3,"time":"June 01, 2022 02:32:46","remoteAddr":"xxx.xxx.xxx.xxx","user":"affecteduseraccount","app":"PHP","method":"POST","url":"/index.php/settings/apps/enable","message":"count(): Parameter must be an array or an object that implements Countable at /home/adminuser/public_html/lib/private/Memcache/Redis.php#81","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36","version":"24.0.1.1","exception":{"Exception":"Error","Message":"count(): Parameter must be an array or an object that implements Countable at /home/adminuser/public_html/lib/private/Memcache/Redis.php#81","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/home/adminuser/public_html/lib/private/Memcache/Redis.php","line":81,"function":"count"},{"file":"/home/adminuser/public_html/lib/private/App/AppManager.php","line":451,"function":"clear","class":"OC\\Memcache\\Redis","type":"->"},{"file":"/home/adminuser/public_html/lib/private/App/AppManager.php","line":326,"function":"clearAppsCache","class":"OC\\App\\AppManager","type":"->"},{"file":"/home/adminuser/public_html/apps/settings/lib/Controller/AppSettingsController.php","line":456,"function":"enableApp","class":"OC\\App\\AppManager","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/adminuser/public_html/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/adminuser/public_html/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/adminuser/public_html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/adminuser/public_html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}


Formatted from logging
[PHP] Error: Error: count(): Parameter must be an array or an object that implements Countable at /home/adminuser/public_html/lib/private/Memcache/Redis.php#81 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError()
 1. /home/adminuser/public_html/lib/private/Memcache/Redis.php line 81
    count()
 2. /home/adminuser/public_html/lib/private/App/AppManager.php line 451
    OC\Memcache\Redis->clear()
 3. /home/adminuser/public_html/lib/private/App/AppManager.php line 326
    OC\App\AppManager->clearAppsCache()
 4. /home/adminuser/public_html/apps/settings/lib/Controller/AppSettingsController.php line 456
    OC\App\AppManager->enableApp()
 5. /home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Settings\Controller\AppSettingsController->enableApps()
 6. /home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController()
 7. /home/adminuser/public_html/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch()
 8. /home/adminuser/public_html/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main()
 9. /home/adminuser/public_html/lib/base.php line 1023
    OC\Route\Router->match()
10. /home/adminuser/public_html/index.php line 36
    OC::handleRequest()

POST /index.php/settings/apps/enable
from xxx.xxx.xxx.xxx by affecteduseraccount at 2022-06-01T02:32:46+00:00

Raw from Logging
{"reqId":"YpbPzhecaMVAckJHTW5oNwAAAAM","level":3,"time":"2022-06-01T02:32:46+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"affecteduseraccount","app":"PHP","method":"POST","url":"/index.php/settings/apps/enable","message":"count(): Parameter must be an array or an object that implements Countable at /home/adminuser/public_html/lib/private/Memcache/Redis.php#81","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36","version":"24.0.1.1","exception":{"Exception":"Error","Message":"count(): Parameter must be an array or an object that implements Countable at /home/adminuser/public_html/lib/private/Memcache/Redis.php#81","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/home/adminuser/public_html/lib/private/Memcache/Redis.php","line":81,"function":"count"},{"file":"/home/adminuser/public_html/lib/private/App/AppManager.php","line":451,"function":"clear","class":"OC\\Memcache\\Redis","type":"->"},{"file":"/home/adminuser/public_html/lib/private/App/AppManager.php","line":326,"function":"clearAppsCache","class":"OC\\App\\AppManager","type":"->"},{"file":"/home/adminuser/public_html/apps/settings/lib/Controller/AppSettingsController.php","line":456,"function":"enableApp","class":"OC\\App\\AppManager","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/adminuser/public_html/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/adminuser/public_html/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/adminuser/public_html/lib/base.php","line":1023,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/adminuser/public_html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/adminuser/public_html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"6296d06b76e4f"}

Is this the first time you’ve seen this error? (Y/N):

Yes

Steps to replicate it:

Install/Activate apps (custom side menu, and others)

The output of your Nextcloud log in Admin > Logging:

Above

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

{
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "www.example.com",
        "example.com",
        "xxx.xxx.xxx.xxx"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "24.0.1.1",
    "overwrite.cli.url": "https:\/\/www.example.com",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "memcache.local": "\\OC\\Memcache\\Redis",
    "filelocking.enabled": true,
    "memcache.locking": "\\OC\\Memcache\\APCu",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 6379,
        "timeout": 0,
        "password": "***REMOVED SENSITIVE VALUE***"
    },
    "default_phone_region": "CN",
    "log_type": "file",
    "logfile": "\/home\/adminuser\/ncerrors\/error.log",
    "loglevel": 2,
    "logdateformat": "F d, Y H:i:s",
    "trashbin_retention_obligation": "3, 7",
    "mail_smtpmode": "sendmail",
    "mail_sendmailmode": "smtp",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpauthtype": "PLAIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "587",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "maintenance": false,
    "auth.bruteforce.protection.enabled": "false",
    "theme": "",
    "app_install_overwrite": [
        "files_antivirus",
        "qownnotesapi",
        "appointments"
    ],
    "data-fingerprint": "9e02b4166b5ccd02c2e1fa2c15895a44",
    "mail_smtpsecure": "tls"
}

The output of your Apache/nginx/system log in /var/log/____:

Just bots not related to ModSec...

[Wed Jun 01 10:01:25.034415 2022] [:error] [pid 2115540] [client 54.193.135.92:35292] [client 54.193.135.92] ModSecurity: Warning. Pattern match "^[\\\\d.:]+$" at REQUEST_HEADERS:Host. [file "/etc/apache2/modsecurity-crs/coreruleset-3.3.2/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "735"] [id "920350"] [msg "Host header is a numeric IP address"] [data "119.12.161.48"] [severity "WARNING"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/210/272"] [tag "PCI/6.5.10"] [hostname "119.12.161.48"] [uri "/owa/auth/logon.aspx"] [unique_id "YpbIdV@5g06iLkWEJpXI7wAAAAI"]
[Wed Jun 01 09:42:10.040697 2022] [:error] [pid 2115538] [client 192.241.221.194:43192] [client 192.241.221.194] ModSecurity: Warning. Pattern match "^[\\\\d.:]+$" at REQUEST_HEADERS:Host. [file "/etc/apache2/modsecurity-crs/coreruleset-3.3.2/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "735"] [id "920350"] [msg "Host header is a numeric IP address"] [data "119.12.161.48"] [severity "WARNING"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/210/272"] [tag "PCI/6.5.10"] [hostname "119.12.161.48"] [uri "/owa/auth/logon.aspx"] [unique_id "YpbD8nBaes52LE6lgXVr1gAAAAA"]```


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
Above