Skip to content

Test cleanup fails all model tests on Windows on Go 1.20 #8779

Closed

Description

@calmh

Pretty much all the tests fail at cleaning up the temp dir:

...
=== RUN   TestWeakHash
2023/02/07 15:28:59 INFO: No stored folder metadata for "default"; recalculating
2023/02/07 15:28:59 INFO: Ready to synchronize "default" (default) (sendreceive)
2023/02/07 15:28:59 INFO: Completed initial scan of sendreceive folder "default" (default)
    testing.go:1206: TempDir RemoveAll cleanup: remove C:\Users\jb\AppData\Local\Temp\TestWeakHash1733825082\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestWeakHash (2.03s)
=== RUN   TestCopierCleanup
2023/02/07 15:29:01 INFO: No stored folder metadata for "default"; recalculating
2023/02/07 15:29:01 INFO: Ready to synchronize "default" (default) (sendreceive)
2023/02/07 15:29:01 INFO: Completed initial scan of sendreceive folder "default" (default)
    testing.go:1206: TempDir RemoveAll cleanup: remove C:\Users\jb\AppData\Local\Temp\TestCopierCleanup3901192848\001: The process cannot access the file because it is being used by another process.
--- FAIL: TestCopierCleanup (1.44s)
...

Activity

  1. added
    bug
    build
    on Feb 7, 2023
  2. imsodin commented on Feb 8, 2023

    @imsodin
    Member

    Looks exactly like this, which is fixed in go1.19, and the code hasn't been changed since that fix:
    golang/go#51442

  3. calmh commented on Feb 9, 2023

    @calmh
    MemberAuthor

    Yes though apparently it has. Our model test are quite convoluted though, especially in terms of setup and tear down, and creates
    a bucketload of temporary files and directories often inside the repo. I started cleaning it up to consistently use the fakefs where possible which removes this issue.

  4. bhasden commented on Apr 13, 2023

    @bhasden

    For what it's worth, I was on one of the original threads where a similar bug was reported and the fix from that thread didn't resolve the issue for me. While investigating, the most likely conclusion I reached was that a file handle not being closed in the Windows file handling code related to temp directories and tests, however I ran out of time before I could pinpoint the exact line of code where the file was being left open when the temp dir cleanup was occurring. For our tests, we worked around the issue by avoiding temp dir creation at all. Based on my findings, no amount of delay or retry is going to resolve this specific Windows issue.

    Caveat, although I've been programming for decades, I'm a newbie with Go. Everything I said above could be completely wrong and/or misleading.

  5. added 3 commits that reference this issue on May 3, 2023
    1d6ebfb
    8de76a9
    1603f9d
  6. added this to the v1.23.5 milestone on May 9, 2023
  7. added a commit that references this issue on Jun 4, 2023
    0842a14
  8. added a commit that references this issue on Jan 28, 2024
    1103a27
  9. added
    frozen-due-to-age
    on May 8, 2024
  10. locked and limited conversation to collaborators on May 8, 2024
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

    bugbuildfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions