Skip to content

[Bug]: Two database connections and missing transaction isolation level for read operations #45003

@ChristophWurst

Description

@ChristophWurst

⚠️ This issue respects the following points: ⚠️

Bug description

I am capturing all queries of my MariaDB installation and noticed a strange query pattern for simple Nextcloud requests:

-- nc_admin@localhost on nextclouddev using Socket
SELECT `appid`, `configkey`, `configvalue`, `type` FROM `oc_appconfig` WHERE `lazy` = 0;
SELECT `uid`, `displayname`, `password` FROM `oc_users` WHERE `uid_lower` = 'admin'
SELECT `gu`.`gid`, `g`.`displayname` FROM `oc_group_user` `gu` LEFT JOIN `oc_groups` `g` ON `gu`.`gid` = `g`.`gid` WHERE `uid` = 'admin'
SELECT `provider_id`, `enabled` FROM `oc_twofactor_providers` WHERE `uid` = 'admin'
SELECT `appid`, `configkey`, `configvalue` FROM `oc_preferences` WHERE `userid` = 'admin'
-- nc_admin@localhost on nextclouddev using Socket
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
SET SESSION AUTOCOMMIT=1
START TRANSACTION
SELECT * FROM `oc_authtoken` WHERE (`uid` = 'admin') AND (`version` = 2) LIMIT 1000
COMMIT
...

Steps to reproduce

  1. Set up Nextcloud with a single node database
  2. Send requests

Expected behavior

Single connection and read queries use READ COMMITTED too, not the global database default.

Installation method

None

Nextcloud Server version

29

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

Related to #41998.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions