nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
831 stars 257 forks source link

php error in cache module, often repeated #4460

Open timreeves opened 3 years ago

timreeves commented 3 years ago

Expected behavior

No errors

Actual behavior

Error: Undefined offset: 52 at /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/apps/mail/lib/Cache/Cache.php#143 The offset seems to get counted in a loop, creating many error messages. For each offset value there are 2 errors, one at line 143 and one at line 145.

Mail app

Mail app version: 1.8.0

Mailserver or service: Self hosted - Plesk / Dovecot + Postfix

Server configuration

Operating system: Debian 10

Web server: Nginx

Database: MariaDB

PHP version: 7.4

Nextcloud Version: 20.0.6

Client configuration

Browser: (e.g. Firefox 48)

Operating system: (e.g. Arch Linux)

timreeves commented 3 years ago

Oh and now I see a further problem:

TypeError: Argument 7 passed to OCA\Mail\Controller\MessagesController::__construct() must be of the type string, null given<<closure>>
OCA\Mail\Controller\MessagesController->__construct()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 101: ReflectionClass->newInstanceArgs()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 109: OC\AppFramework\Utility\SimpleContainer->buildClass()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 126: OC\AppFramework\Utility\SimpleContainer->resolve()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 455: OC\AppFramework\Utility\SimpleContainer->query()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 427: OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/App.php - line 139: OC\AppFramework\DependencyInjection\DIContainer->query()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/Route/Router.php - line 309: OC\AppFramework\App::main()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/base.php - line 1008: OC\Route\Router->match()/var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/index.php - line 37: OC::handleRequest()
ChristophWurst commented 3 years ago

The offset seems to get counted in a loop, creating many error messages. For each offset value there are 2 errors, one at line 143 and one at line 145.

Mind sharing the error log entry?

ChristophWurst commented 3 years ago

this was also reported before but with no further investigation: https://github.com/nextcloud/mail/issues/3881

timreeves commented 3 years ago

Hi Christoph, would be glad to - but now it won't reproduce. And I manually truncated the error log after reporting. Very sorry! All I can add on that one is my cache config:

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => 'true',
  'filelocking.ttl' => 1800,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
    'dbindex' => 1,
  )

But now the second problem I noted is flooding my error log, here better formatted (Help! Help! cried piglet):

TypeError: Argument 7 passed to OCA\Mail\Controller\MessagesController::__construct() must be of the type string, null given

    <<closure>>

    OCA\Mail\Controller\MessagesController->__construct()

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 101:

    ReflectionClass->newInstanceArgs()

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 109:

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

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/Utility/SimpleContainer.php - line 126:

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

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 455:

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

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/DependencyInjection/DIContainer.php - line 427:

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

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/AppFramework/App.php - line 139:

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

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/private/Route/Router.php - line 309:

    OC\AppFramework\App::main()

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/lib/base.php - line 1008:

    OC\Route\Router->match()

    /var/www/vhosts/sat-chit-ananda.org/owncloud.sat-chit-ananda.org/index.php - line 37:

    OC::handleRequest()
timreeves commented 3 years ago

Oh dear, so sorry: Amid the other error notices I noticed some about not being able to get a DB connection. So I doubled the number allowed and restarted the DB server. Now error messages are gone. For now, let's assume that that was the root cause, and I'm closing this here. Many thanks!

timreeves commented 3 years ago

Er nope, latter error still comes sometimes. New Issue opened.

timreeves commented 3 years ago

Now overnight, I got lots more of those cache errors, here are the details of one:

Error: Undefined offset: 2249 at /var/www/vhosts/...apps/mail/lib/Cache/Cache.php#145
/var/www/vhosts/.../apps/mail/lib/Cache/Cache.php - line 145:
OC\Log\ErrorHandler::onError()<<closure>>OCA\Mail\Cache\Cache->save()

Hope this helps. Please feel free to suggest debugging measures / ask for more details.

A reminder how my cache is configured:

'memcache.local' => '\OC\Memcache\APCu',
'filelocking.enabled' => 'true',
'filelocking.ttl' => 1800,
'memcache.locking' => '\OC\Memcache\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'timeout' => 0,
'dbindex' => 1,
)

An afterthougth: Maybe my APCu settings in php.ini are too low? Here they are:

apc.enabled=1
; The size of each shared memory segment in MB. By default, some systems (including most BSD variants) have very low limits on the size of a shared memory segment.
apc.shm_size=2M
; The number of seconds a cache entry is allowed to idle in a slot in case this cache entry slot is needed by another entry.
; Leaving this at zero means that APC's cache could potentially fill up with stale entries while newer entries won't be cached.
apc.ttl=7200
; A "hint" about the number of distinct variables that might be stored. Set to zero or omit if not sure.
apc.entries_hint=0
; apc.mmap_file_mask=/tmp/apc.XXXXXX
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.