Skip to content

Excessive resource usage from case insensitivity filesystem layer #9836

Closed

Description

@clonejo

What happened?

After upgrading to v1.28.0, i am observing a rapid memory leak once Syncthing is started. It takes only a few minutes to fill all my 16GB of RAM. The issue also occurs on v1.28.1-rc.2. The issue does not occur on v1.27.12, that version only uses around 700MB of memory (RES).

I did not see any useful log messages.

Interestingly enough, the OOM killer on this Debian system does not trigger, and the system just stays unresponsive forever (or at least for 12+ hours).

Stats (rounded):
Files: 900,000
Folders: 100,00
Size: 4.00 TiB

I am not much into Go, is there an easy way to debug memory usage, or where allocations are made?

Syncthing version

v1.28.0

Platform & operating system

Linux amd64

Browser version

No response

Relevant log output

No response

Activity

  1. added
    bug
    needs-triage
    on Nov 26, 2024
  2. calmh commented on Nov 27, 2024

    @calmh
    Member

    Yes, run with --debug-profile-heap and Syncthing will create a series of heap profiles as usage grows. Grab the biggest/latest one and post it and we can maybe see what's going on.

  3. clonejo commented on Nov 27, 2024

    @clonejo
    Author

    Oh, sorry, i missed that one in the --help. Here you go:
    heap-337438.pprof.tar.gz

    profile005

    The 2GB shown is still far away from the 8GB Syncthing ends up using, where it runs into the MemoryHigh=8G limit set by me and gets throttled. 2GB is still more than the memory usage on older versions, so this profile should already show the problem.

    (profile taken on Syncthing v1.28.1-rc.2)

  4. calmh commented on Nov 27, 2024

    @calmh
    Member

    Yeah, that's two gigs of cached dir names for the case insensitivity check.

    This does seem a bit excessive.

  5. removed
    needs-triage
    on Nov 27, 2024
  6. changed the title [-]Memory leak in v1.28.0[/-] [+]Excessive memory usage from cached dir names in v1.28.0[/+] on Nov 27, 2024
  7. calmh commented on Nov 27, 2024

    @calmh
    Member

    Can you post the configs from both sides please? Redacting any IDs and secrets as you like, I'm mostly interested in all the folder and device options as it seems there is a lot going on here.

  8. clonejo commented on Nov 27, 2024

    @clonejo
    Author

    I have a number of peers and folders, but pausing hosts and folders allowed me to narrow it down.

    The causing folder has ~300k files. 200k of those are in one directory, unfortunately. On the local (memleaking) Syncthing node, it shows that a remote node is missing 100k elements. On the web interface of that remote node, only ~10 elements are actually shown as missing. The remote node is running Syncthing v1.27.2. When i downgrade the local node to 1.27, the missing 100k elements are still shown, but the number appears to go down.

    Both nodes run on Linux amd64.

    configs.tar.gz

    Thanks for investigating!

  9. calmh commented on Nov 28, 2024

    @calmh
    Member

    Yeah, OK, I see where this is coming from, thanks.

  10. calmh commented on Dec 1, 2024

    @calmh
    Member

    Let me modify that, I don't know where this is coming from... In the general sense I can see that our fs caching for case insensitivity lookups is probably mostly ineffective in your setup (too few entries for too short a time), but the thing I thought was broken isn't. (I've written tests to try to prove brokenness, but it's not there.) I don't see why there would be a difference in 1.28 vs earlier releases.

  11. imsodin commented on Dec 16, 2024

    @imsodin
    Member

    I still don't see how the case caching/registry could do this, but it keeps coming up so I added some debug logging around it. If you can run tomorrows nightly build (otherwise next RC or release), could you repro with fs debug logging enabled and provide those logs please - that would then indicate if the registry is working as expected or not.

  12. added theissue type on May 30, 2025
  13. added a commit that references this issue on Oct 18, 2025
    b4565c8
  14. added this to the v2.0.11 milestone on Nov 3, 2025
  15. marbens-arch commented on Nov 5, 2025

    @marbens-arch
    Member

    If #10430 fixes this issue, and the memory usage is from the DirNames calls themselves (which does seem to be the case for the heap profile mentioned in #9836 (comment)), then the title is not accurate, it's from to-be-cached dir names, not cached dir names.

  16. changed the title [-]Excessive memory usage from cached dir names in v1.28.0[/-] [+]Excessive memory usage from case insensitivity filesystem layer[/+] on Nov 5, 2025
  17. changed the title [-]Excessive memory usage from case insensitivity filesystem layer[/-] [+]Excessive resource usage from case insensitivity filesystem layer[/+] on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions