Closed Bug 1853221 Opened 2 years ago Closed 1 year ago

./mach fluent-migration-test fails on Windows when it is run a second time in a VSCode integrated terminal

Categories

(Testing :: General, defect)

defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: tgiles, Unassigned)

References

(Blocks 1 open bug)

Details

I'm not sure if this impacts other operating systems, and I can't reproduce the issue if I use the MozillaBuild shell outside of the VSCode integrated terminal. Maybe this is just due to my setup and can get closed accordingly but I figure I would file a bug regardless 🙂

STR:

  1. Run Visual Studio Code on Windows (I'm running Win 10, maybe it doesn't repro on Win 11, I don't know)
  2. Open an integrated cmd terminal
  3. Start up the MozillaBuild shell
  4. Navigate to your local Firefox repo
  5. Run ./mach fluent-migration-test python/l10n/fluent_migrations/bug_1552333_aboutCertError.py
  6. Observe the fluent-migration test ran without issue
  7. Run mach fluent-migration-test python/l10n/fluent_migrations/bug_1552333_aboutCertError.py again

Expected result:

  1. Test runs without issue

Actual result:

$ mach fluent-migration-test python/l10n/fluent_migrations/bug_1552333_aboutCertError.py
 0:01.04 hg pull -u
Error running mach:

    ['fluent-migration-test', 'python/l10n/fluent_migrations/bug_1552333_aboutCertError.py']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file fluent-migration-test| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'G:/mozilla/mozilla-unified/obj-x86_64-pc-mingw32/python/l10n/bug_1552333_aboutCertError\\en-US'

  File "G:\mozilla\mozilla-unified\testing\mach_commands.py", line 1129, in run_migration_tests
    rv |= fmt.test_migration(command_context, obj_dir, **context)
  File "g:\mozilla\mozilla-unified\python\l10n\test_fluent_migrations\fmt.py", line 83, in test_migration
    shutil.rmtree(work_dir)
  File "C:\mozilla-build\python3\lib\shutil.py", line 749, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\mozilla-build\python3\lib\shutil.py", line 622, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\mozilla-build\python3\lib\shutil.py", line 631, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "C:\mozilla-build\python3\lib\shutil.py", line 629, in _rmtree_unsafe
    os.rmdir(path)

Sentry event ID: 30a7e9b5f6f34625a6e211c812ec0c81

I'm not sure how the G:/mozilla/mozilla-unified/obj-x86_64-pc-mingw32/python/l10n/bug_1552333_aboutCertError\\en-US string is getting generated but that seems like a likely culprit. I can repro this bug consistently, so please let me know what other information I can provide!

The severity field is not set for this bug.
:jmaher, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmaher)

I am not sure who creates the visual studio integration, or if that is part of this bug.

I run windows 11 2023H1 and I was unable to reproduce in 2 ways:

  1. normal cmd.exe with mozilla build, then run the mach command twice in a row
  2. open up vs code, terminal+new terminal, in the powershell launch mozilla build, then run mach command twice in a row

If another process is using the file, is it possible there is something else running in another window or shell?

I would vote to mark this as wontfix, I am not sure if others can reproduce this or not.

Flags: needinfo?(jmaher)

Tim, there are a couple of ways to see what process has the file locked, can you try and find out what is locking this file when it occurs?

https://superuser.com/questions/117902/find-out-which-process-is-locking-a-file-or-folder-in-windows

Flags: needinfo?(tgiles)

Finally had some time to track down this issue. It seems to be an issue with an extension in VS Code, specifically one of the Hg extensions (mrcrowl.hg or vivekvijayan.hg). Once I uninstalled both of these, I'm able to run mach fluent-migration-test without issue.

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(tgiles)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.