Unexpected logouts

Nextcloud version: 11.0.0
Operating system and version: Gentoo Base System release 2.2 (Managed server at DomainFactory)
Apache or nginx version: Apache/2.4.20
PHP version: 7.0.13
Is this the first time you’ve seen this error and can you replicate it?: I’m able to reproduce it!

The issue you are facing:

I get logged out from Nextcloud unexpectedly a lot. This happens in different flavors:

  • when I access Admin > Server info and do nothing, I’m logged out after a couple of seconds.
  • when I access Admin > Server info, then flip through other admin sections I’m quite often loggend out immediately.
  • when I access a shared directory and do nothing, I’m often logged out after some minutes.

All this is not 100% reproduceable. I tried to measure the time it takes until logout but it differs a lot.

The output of your Nextcloud log in Admin > Logging:

Error	PHP	String offset cast occurred at /pathto//nextcloud/apps/files_sharing/lib/Activity/Providers/Users.php#238
Error	PHP	key() expects parameter 1 to be array, string given at /pathto//nextcloud/apps/files_sharing/lib/Activity/Providers/Users.php#236
Error	PHP	String offset cast occurred at /pathto//nextcloud/apps/files_sharing/lib/Activity/Providers/Users.php#238
Error	PHP	key() expects parameter 1 to be array, string given at /pathto//nextcloud/apps/files_sharing/lib/Activity/Providers/Users.php#236
Error	PHP	key() expects parameter 1 to be array, string given at /pathto//nextcloud/apps/files/lib/Activity/Provider.php#251
Error	PHP	reset() expects parameter 1 to be array, string given at /pathto//nextcloud/apps/files/lib/Activity/Provider.php#250
Error	core	Error while running background job (Doctrine\DBAL\Exception\SyntaxErrorException): An exception occurred while executing 'DELETE FROM `oc_activity_mq` WHERE `amq_timestamp` <= ? AND `amq_affecteduser` IN ()' with params [1484295762]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

The output of your config.php file:

<?php
$CONFIG = array (
  'instanceid' => '*********',
  'passwordsalt' => '*********',
  'secret' => '*********',
  'trusted_domains' =>
  array (
    0 => 'www.domain.tld',
    1 => 'subdomain.anotherdomain.tld',
  ),
  'datadirectory' => '/pathto/cloud/cloud-data',
  'overwrite.cli.url' => 'https://www.domain.tld/cloud',
  'dbtype' => 'mysql',
  'version' => '11.0.0.10',
  'dbname' => '*********',
  'dbhost' => '127.0.0.3',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*********',
  'dbpassword' => '*********',
  'htaccess.RewriteBase' => '/cloud',
  'logtimezone' => 'UTC',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'tempdirectory' => '/pathto/cloud/cloud-temp',
  'updater.release.channel' => 'stable',
);

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

not available

Perhaps you could try to set this parameters in config.php:
'session_lifetime' => 60 * 60 * 24,
The lifetime of a session after inactivity; the default is 24 hours, expressed in seconds.
'session_keepalive' => true,
Enable or disable session keep-alive when a user is logged in to the Web UI.

https://docs.nextcloud.com/server/11/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=config

In cas you have not yet figured this out: Have a look at this thread: Bug with Nextcloud Web Interface: automatically unwanted logout