Skip to content

Scanning on Linux ext4 very slow in version 1.22.0 #8590

Closed

Description

@mickgiles
  • which version of Syncthing and what operating system you are using
    1.22.0

  • what happened,
    I have 3 servers syncing. 1 is MacOs M1 that has no issues. The other 2 are Ubuntu x86_64 on kernel 4.15.0-192 and 5.15.0-362206031516 and both of them are constantly thrashing the disk and never completing syncing.
    I have not enabled any of the new extended attribute settings in 1.22.0

  • what you expected to happen instead, and
    Expect it to scan as fast as 1.21.0 and/or the MacOs with 1.22.0

  • any steps to reproduce the problem.
    upgrade from 1.21.0 to 1.22.0 on an Ubuntu os with and ext4 file system

Activity

  1. added
    bug
    needs-triage
    on Oct 7, 2022
  2. calmh commented on Oct 7, 2022

    @calmh
    Member

    "constantly thrashing the disk and never completing syncing" doesn't sound like scanning, in Syncthing terminology.

    Do you have logs of what it's doing? I'm not aware of any relevant changes in 1.22.0, apart from obviously the xattr stuff that you didn't enable.

  3. mickgiles commented on Oct 7, 2022

    @mickgiles
    Author

    Here are logs of pressing "rescan" on a small folder on both macos and ubuntu. I only enabled the scanner log.
    It looks like that on ubuntu it for some reason believes some, but not all, files have changed and it re-hashes them
    On some of my larger directories it just continues re-hashing and never finishes

    Working -- macos
    macos.txt

    Not working -- ununtu
    ubuntu.txt

  4. calmh commented on Oct 7, 2022

    @calmh
    Member

    So, the one new thing that would cause that is we now record the inode change time and use it when comparing for changes. Unfortunately that value isn't printed in the debug output (adding that now...) but you can inspect it using the CLI for a known file;

    syncthing cli debug file $folderID $filePath
    

    If you could paste the output for a file that keeps getting rescanned so we can see which attributes change that would be helpful. If it's just the inode change time, that's ... odd, I don't know why it would keep changing, but it would explain what's going on.

    Are you running anything else that might be relevant at the same time -- some dedup thing, or some backup program that sets attributes on the files to mark the processed, or something like that?

    (FTR I'm not seeing this at all on Linux, but my files are on ZFS.)

  5. mickgiles commented on Oct 7, 2022

    @mickgiles
    Author
    {
      "availability": [
        "<redacted>",
        "<redacted>"
      ],
      "global": {
        "deleted": false,
        "ignored": false,
        "inodeChange": "1969-12-31T18:00:00-06:00",
        "invalid": false,
        "localFlags": 0,
        "modified": "2022-09-22T22:23:25.549513628-05:00",
        "modifiedBy": "XI3MV2B",
        "mustRescan": false,
        "name": "<redacted>",
        "noPermissions": true,
        "numBlocks": 1525,
        "platform": {
          "darwin": null,
          "freebsd": null,
          "linux": null,
          "netbsd": null,
          "unix": null,
          "windows": null
        },
        "sequence": 414,
        "size": 3196579256,
        "type": "FILE_INFO_TYPE_FILE",
        "version": [
          "XI3MV2B:1665164603"
        ]
      },
      "globalVersions": "{{Version:{[{XI3MV2B 1665164603}]}, Deleted:false, Devices:{ZMBI6TA, 7777777}, Invalid:{}}}",
      "local": {
        "deleted": false,
        "ignored": false,
        "inodeChange": "2022-10-07T12:45:11.156467433-05:00",
        "invalid": false,
        "localFlags": 0,
        "modified": "2022-09-22T22:23:25.549513628-05:00",
        "modifiedBy": "XI3MV2B",
        "mustRescan": false,
        "name": "<redacted>",
        "noPermissions": true,
        "numBlocks": 1525,
        "platform": {
          "darwin": null,
          "freebsd": null,
          "linux": null,
          "netbsd": null,
          "unix": null,
          "windows": null
        },
        "sequence": 1641,
        "size": 3196579256,
        "type": "FILE_INFO_TYPE_FILE",
        "version": [
          "XI3MV2B:1665164603"
        ]
      },
      "mtime": {
        "err": null,
        "value": {
          "real": "0001-01-01T00:00:00Z",
          "virtual": "0001-01-01T00:00:00Z"
        }
      }
    }
    
  6. mickgiles commented on Oct 7, 2022

    @mickgiles
    Author

    The ones I see rescanning all have 1969-12-31T18:00:00-06:00 in one or the other inodeChange fields and a current date in the other. Ones that work either have 1969-12-31T18:00:00-06:00 in both or a current date in both.

  7. calmh commented on Oct 7, 2022

    @calmh
    Member

    Yeah both of those situations are normal, the question is if the ones that have a current date in the local part have that date change from pass to pass.

  8. mickgiles commented on Oct 7, 2022

    @mickgiles
    Author

    I can confirm they are not changing between scans yet that file is scanned every time
    I even did a json diff of the output and confirmed no values are changing
    Also confirmed the directory the same way and it is also not changing

  9. schuetzm commented on Oct 8, 2022

    @schuetzm

    Could this be caused by an overflow? The date obviously corresponds to the start of the unix epoch, but if it ignores the timezone part, we'd get a negative number. If it then interprets that as an unsigned int, it will be larger than the current time.

  10. calmh commented on Oct 8, 2022

    @calmh
    Member

    No, there's no overflow, the comparison looks at the timestamp as nanoseconds-since-the-epoch, the rest is just formatting for the current time zone. I have no idea what would cause the behaviour in question, but the debug output from the scanner is kind of crappy -- both ridiculously verbose and lacking relevant details at the same time, so I'll improve that and then we can test this with a dev build.

  11. mickgiles commented on Oct 8, 2022

    @mickgiles
    Author

    Something a little interesting to add to this. On the smaller folder I've been testing on I ran find . -type f -exec touch {} + and after it scanned everything once it is no longer reproducible on that folder.
    I do still have more folders I can reproduce this on when you get a build that you want me to try.

  12. calmh commented on Oct 8, 2022

    @calmh
    Member

    So when scanned "locally" they're fine... if you touch one of those files from another host, so that the changed gets synced to the problematic one, does that trigger the problem for that file?

  13. mickgiles commented on Oct 8, 2022

    @mickgiles
    Author

    Now that I have touched all the files in that folder it is no longer reproducible. Touching on any of the remote hosts causes them to rescan but does not trigger the issue on the local problematic host.
    It's worth noting that for the folders that this is still reproducible on, if I downgrade to 1.21.0 it is fine again. Upgrading to 1.22.0 triggers it again but not for the folder that I have touched all the files in.

  14. calmh commented on Oct 8, 2022

    @calmh
    Member

    I wonder what's special then, given that it wasn't that the new attribute we look at keeps changing. Why isn't everyone seeing this on their computers...

  15. mickgiles commented on Oct 8, 2022

    @mickgiles
    Author

    I can certainly just touch all the files and let it rescan them to solve for myself but it would be good to understand why this is happening.

  16. mickgiles commented on Oct 8, 2022

    @mickgiles
    Author

    Another interesting test...
    On the MacOs host running 1.22.0 I touched all the files in a problematic directory and let that sync to the problematic Ubuntu hosts while they were running 1.21.0. I then upgraded them to 1.22.0 and that directory was fine after that everywhere.

  17. self-assigned this
    on Oct 11, 2022
  18. added
    frozen-due-to-age
    on Oct 16, 2023
  19. locked and limited conversation to collaborators on Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfrozen-due-to-ageneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions