Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ea9a253
Properly report error when object type param default references self
compiler-errors Jan 24, 2025
c9ae0bb
Fix `FormattingOptions` instantiation with `Default`
nyurik Jan 24, 2025
8175bf3
Rename test to `unresolvable-upvar-issue-87987.rs`
Zalathar Jan 24, 2025
6c7e8fe
Add some notes and test some more pattern variants
Zalathar Jan 20, 2025
e170c9d
Fix set_name in thread mod for NuttX
no1wudi Jan 24, 2025
571f3ed
bootstrap: Handle bootstrap lockfile race condition better
clubby789 Jan 24, 2025
91b7593
Use short ty string for move errors
estebank Jan 24, 2025
ab7793d
Don't move ownership of job object
ChrisDenton Jan 24, 2025
8873c18
Skip suggestions in `derive`d code
estebank Jan 24, 2025
5f8bcec
fix(bootstrap): deserialize null as `f64::NAN`
weihanglo Jan 25, 2025
9ffe558
Rollup merge of #135971 - compiler-errors:self-projection, r=fmease
matthiaskrgr Jan 25, 2025
5c821ae
Rollup merge of #135977 - nyurik:fix-fmt-options, r=joboet
matthiaskrgr Jan 25, 2025
eb3e1c9
Rollup merge of #135985 - Zalathar:whats-upvar, r=lqd
matthiaskrgr Jan 25, 2025
7a79024
Rollup merge of #135991 - no1wudi:master, r=thomcc
matthiaskrgr Jan 25, 2025
6cb2820
Rollup merge of #136009 - clubby789:pidfile-race, r=jieyouxu
matthiaskrgr Jan 25, 2025
2080d66
Rollup merge of #136018 - estebank:long-moved-type, r=jieyouxu
matthiaskrgr Jan 25, 2025
06349ec
Rollup merge of #136027 - estebank:issue-135989, r=compiler-errors
matthiaskrgr Jan 25, 2025
7b16b4e
Rollup merge of #136029 - ChrisDenton:py-job, r=jieyouxu
matthiaskrgr Jan 25, 2025
a330c7e
Rollup merge of #136034 - weihanglo:null-as-f64-nan, r=compiler-errors
matthiaskrgr Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't move ownership of job object
  • Loading branch information
ChrisDenton committed Jan 24, 2025
commit ab7793d4d4d35551480cb2b6823903974316a9fa
3 changes: 0 additions & 3 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,6 @@ def bootstrap(args):
args = [build.bootstrap_binary()]
args.extend(sys.argv[1:])
env = os.environ.copy()
# The Python process ID is used when creating a Windows job object
# (see src\bootstrap\src\utils\job.rs)
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
run(args, env=env, verbose=build.verbose, is_bootstrap=True)

Expand Down
51 changes: 4 additions & 47 deletions src/bootstrap/src/utils/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ pub unsafe fn setup(build: &mut crate::Build) {
#[cfg(windows)]
mod for_windows {
use std::ffi::c_void;
use std::{env, io, mem};
use std::{io, mem};

use windows::Win32::Foundation::{CloseHandle, DUPLICATE_SAME_ACCESS, DuplicateHandle, HANDLE};
use windows::Win32::Foundation::CloseHandle;
use windows::Win32::System::Diagnostics::Debug::{
SEM_NOGPFAULTERRORBOX, SetErrorMode, THREAD_ERROR_MODE,
};
Expand All @@ -53,9 +53,7 @@ mod for_windows {
JOB_OBJECT_LIMIT_PRIORITY_CLASS, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
JobObjectExtendedLimitInformation, SetInformationJobObject,
};
use windows::Win32::System::Threading::{
BELOW_NORMAL_PRIORITY_CLASS, GetCurrentProcess, OpenProcess, PROCESS_DUP_HANDLE,
};
use windows::Win32::System::Threading::{BELOW_NORMAL_PRIORITY_CLASS, GetCurrentProcess};
use windows::core::PCWSTR;

use crate::Build;
Expand Down Expand Up @@ -95,49 +93,8 @@ mod for_windows {
return;
}

// If we've got a parent process (e.g., the python script that called us)
// then move ownership of this job object up to them. That way if the python
// script is killed (e.g., via ctrl-c) then we'll all be torn down.
//
// If we don't have a parent (e.g., this was run directly) then we
// intentionally leak the job object handle. When our process exits
// Note: we intentionally leak the job object handle. When our process exits
// (normally or abnormally) it will close the handle implicitly, causing all
// processes in the job to be cleaned up.
let pid = match env::var("BOOTSTRAP_PARENT_ID") {
Ok(s) => s,
Err(..) => return,
};

let parent = match OpenProcess(PROCESS_DUP_HANDLE, false, pid.parse().unwrap()).ok() {
Some(parent) => parent,
_ => {
// If we get a null parent pointer here, it is possible that either
// we have an invalid pid or the parent process has been closed.
// Since the first case rarely happens
// (only when wrongly setting the environmental variable),
// it might be better to improve the experience of the second case
// when users have interrupted the parent process and we haven't finish
// duplicating the handle yet.
return;
}
};

let mut parent_handle = HANDLE::default();
// If this fails, well at least we tried! An example of DuplicateHandle
// failing in the past has been when the wrong python2 package spawned this
// build system (e.g., the `python2` package in MSYS instead of
// `mingw-w64-x86_64-python2`). Not sure why it failed, but the "failure
// mode" here is that we only clean everything up when the build system
// dies, not when the python parent does, so not too bad.
let _ = DuplicateHandle(
GetCurrentProcess(),
job,
parent,
&mut parent_handle,
0,
false,
DUPLICATE_SAME_ACCESS,
);
CloseHandle(parent).ok();
}
}
Loading