⚠️ This issue respects the following points: ⚠️
Bug description
There might be a race condition in ShareProvider, where several requests in parallel check if share exists in DB, and create it otherwise. In this case, there could be several new entries created, each with unique id, but all pointing to the same share.
If user tries to modify/leave share, it will modify the first row only, keeping the second intact. That way, you can never get rid of it.
Steps to reproduce
Don't have clear steps, but example behaviour sounds logical:
- Sharing a file in Talk creates a parent entry with
share_type 10 and file_target /{TALK_PLACEHOLDER}/file.md
- User access conversation with shared file as last message, filesystem is mounted from conversations request and chat messages request
- This creates two entries in DB with
share_type 11 and file_target /Talk/file.md (best reproducible when PHP debugger was enabled, but also occurs on prod/daily instances)
3.1. Worse case if user at some point changed the attachments folder, so initial entry is share_type 11 and file_target /Talk/file.md, and duplicates are share_type 11 and file_target /SomeOtherPath/file.md. Modifications will touch only first occurence of /SomeOtherPath/file.md
Expected behavior
Some sort of transactional lock (to write in DB only once) in place
Nextcloud Server version
master
Details
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?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
Bug description
There might be a race condition in ShareProvider, where several requests in parallel check if share exists in DB, and create it otherwise. In this case, there could be several new entries created, each with unique id, but all pointing to the same share.
If user tries to modify/leave share, it will modify the first row only, keeping the second intact. That way, you can never get rid of it.
Steps to reproduce
Don't have clear steps, but example behaviour sounds logical:
share_type10 andfile_target/{TALK_PLACEHOLDER}/file.mdshare_type11 andfile_target/Talk/file.md (best reproducible when PHP debugger was enabled, but also occurs on prod/daily instances)3.1. Worse case if user at some point changed the attachments folder, so initial entry is
share_type11 andfile_target/Talk/file.md, and duplicates areshare_type11 andfile_target/SomeOtherPath/file.md. Modifications will touch only first occurence of /SomeOtherPath/file.mdExpected behavior
Some sort of transactional lock (to write in DB only once) in place
Nextcloud Server version
master
Details
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?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response