Closed Bug 1754299 Opened 3 years ago Closed 3 years ago

./mach doc fails to unlink/remove file in use by other process, breaking `mach doc` on Windows

Categories

(Developer Infrastructure :: Source Documentation, defect)

Desktop
Windows
defect

Tracking

(firefox-esr91 unaffected, firefox98 wontfix, firefox99 wontfix, firefox100 wontfix, firefox101 fixed)

RESOLVED FIXED
101 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox98 --- wontfix
firefox99 --- wontfix
firefox100 --- wontfix
firefox101 --- fixed

People

(Reporter: handyman, Assigned: Gijs)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file machdocfail.txt

./mach doc (on Windows 10) runs for a few minutes and then terminates with this error:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\dapar\\AppData\\Local\\Temp\\tmpkhcpmynf'

  File "c:\mozilla-src\mozilla-unified\tools/moztreedocs/mach_commands.py", line 165, in build_docs
    status, warnings = _run_sphinx(docdir, savedir, fmt=fmt, jobs=jobs, verbose=verbose)
  File "c:\mozilla-src\mozilla-unified\tools/moztreedocs/mach_commands.py", line 288, in _run_sphinx
    os.unlink(warn_path)

The full log of this run is attached.

The missing file does not exist before mach doc is run. I am not simultaneously using any other applications that should be touching these files. My repo was updated today. I don't know the last time I successfully built docs but I think it was only a couple of weeks ago.

I've tried running mach bootstrap and mach clobber first but get the same error. As suggested by the output, it gets far enough that I can open the generated HTML files in docs/html, although it looks like the failure is from warn_path.

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Documentation Infrastructure' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Documentation Infrastructure

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(sledru)

Andrew, what do you think about this one ?

Flags: needinfo?(sledru) → needinfo?(ahal)

I'm not really sure what's going on here. Looks like this warn_path file was added in bug 1748845. My best guess is that something is failing in the Sphinx build, so Sphinx is still holding onto that file. Then when we hit the finally block, there's an exception raised which obscures the real error.

David, do you see any other errors if you comment out that os.unlink call?

Flags: needinfo?(ahal) → needinfo?(davidp99)
Regressed by: 1748845

Set release status flags based on info from the regressing bug 1748845

Earlier in the build process I also see:

C:\mozilla-build\python3\python.exe: can't open file 'path\to\srcdir\doc': [Errno 2] No such file or directory

Which doesn't seem good. There's no context to indicate where that's from. It appears straight after:

updating environment: [new config] 1767 added, 0 changed, 0 removed

and before a dump of environment variables.

(In reply to Andrew Halberstadt [:ahal] from comment #4)

I'm not really sure what's going on here. Looks like this warn_path file was added in bug 1748845. My best guess is that something is failing in the Sphinx build, so Sphinx is still holding onto that file.

There are a lot of warnings printed to the console, but I see those on macOS too. I wonder if this is just Windows being more upset about deleting files used by other apps than unix systems are? This is not that uncommon...

Then when we hit the finally block, there's an exception raised which obscures the real error.

Can you elaborate on this? I don't see a catch block so I don't understand why this would obscure a "real" error; the real error would have surfaced earlier in the log if it threw an exception and was uncaught, right?

David, do you see any other errors if you comment out that os.unlink call?

No, if I comment it out the docs page loads as expected and everything appears to be fine.

Flags: needinfo?(davidp99) → needinfo?(ahal)
Blocks: 1763208
OS: Unspecified → Windows
Hardware: Unspecified → Desktop
Summary: ./mach doc fails to open file in use by other process → ./mach doc fails to unlink/remove file in use by other process, breaking `mach doc` on Windows

Sorry for the tardy -- was on PTO til yesterday. FWIW I see what Gijs reports -- no errors, just the usual ton of warnings. When the unlink is removed, it builds the docs and launches them in the browser as expected. I'm also still seeing the "FileNotFound" on README.rst.

Can you elaborate on this? I don't see a catch block so I don't understand why this would obscure a "real" error; the real error would have surfaced earlier in the log if it threw an exception and was uncaught, right?

Yeah, mostly I'm unsure how Sphinx works under the hood. I see we're passing in --jobs so it's possible that there's some subprocess being left running that still has a handle on the file.. But this would only happen if there were some (pretty major) bug in Sphinx, so agree it's unlikely. And like you said, one would assume some kind of error is displayed if it did.

Flags: needinfo?(ahal)

How can we move forward here? The documentation mach command needs to work on Windows. I'm happy to help but honestly unsure if we can just remove the unlink or need to do something more complicated or what, exactly.

Flags: needinfo?(sledru)
Flags: needinfo?(ahal)

gijs, yeah, can you do it? (remove unlink). We will see if we regress!

Flags: needinfo?(sledru)
Flags: needinfo?(ahal)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/30e7950d0c10 remove os.unlink call from mach doc that fails on Windows, r=ahal,jgraham
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: