nextcloud / nextcloud/server

File scanner does not detect endless loops when scanning external storage

Open
#6,395 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement feature: external storage feature: filesystem hotspot: filename handling
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

  • create and link to external smb storage on linux samba server
  • samba server should have "follow symlinks" enabled (this is samba default)
  • create a symlink in the target smb storage location that loops back to itself
  • nextcloud file scanner will follow this link indefinitely

I suspect we've been suffering from this problem for a long time now, but I only recently clued in to the problem after our upgrade to NC-12.0.2 when investigating why our oc_filecache table had grown so large (500 million rows!).

Once I noticed the filecache entries corresponding to the smb file path loop, I was able to remove the offending directory structure, and now I'm running 'occ files:scan' processes to clean up the mess. So far oc_filecache size has been reduced from ~500 million to 420 million rows, and I expect this to drop much more.

Please let me know if more information is needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the occ files:scan entry point and the affected oc_filecache entries for the external SMB path. Trace how the scanner handles the self-referential symlink, then verify that scanning stops rather than following the loop indefinitely and that normal external-storage scanning still completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, php
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.