Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory #110979

Merged
merged 1 commit into from
Apr 29, 2023

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Apr 29, 2023

This fixes the following recurring error on windows:

Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'

Fixes #107018.

r? @ChrisDenton

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 29, 2023
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable but can we not ask nicely for the server to shutdown cleanly?

src/bootstrap/bootstrap.py Show resolved Hide resolved
src/bootstrap/bootstrap.py Outdated Show resolved Hide resolved
@jyn514
Copy link
Member Author

jyn514 commented Apr 29, 2023

What does "shutdown cleanly" mean here? I don't think the proc-macro server itself holds any state, it's the main rust-analyzer process that has state.

@jyn514
Copy link
Member Author

jyn514 commented Apr 29, 2023

Oh, you just mean remove -Force - sure, I can do that.

…ectory

This fixes the following recurring error on windows:
```
Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
```
@ChrisDenton
Copy link
Member

Ok lgtm

@bors r+

@bors
Copy link
Contributor

bors commented Apr 29, 2023

📌 Commit 500c19c has been approved by ChrisDenton

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2023
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 29, 2023
windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory

This fixes the following recurring error on windows:
```
Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
```

Fixes rust-lang#107018.

r? `@ChrisDenton`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 29, 2023
windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory

This fixes the following recurring error on windows:
```
Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
```

Fixes rust-lang#107018.

r? ``@ChrisDenton``
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#105848 (rustdoc: Add a new lint for broken inline code)
 - rust-lang#110644 (Update tests for libtest `--format json`)
 - rust-lang#110950 (Deny the `unsafe_op_in_unsafe_fn` lint in `rustc_arena`.)
 - rust-lang#110951 (Add support for LibreSSL 3.7.x)
 - rust-lang#110964 (rustdoc: fix weird margins between Deref impl items)
 - rust-lang#110979 (windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 72de69e into rust-lang:master Apr 29, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap fails to wipe the sysroot directory on Windows if proc-macro-server is being used
5 participants