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

interpret: do not ICE when a promoted fails with OOM #133164

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Nov 18, 2024

Fixes #130687

try-job: aarch64-apple
try-job: dist-x86_64-linux

@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2024

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 18, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2024

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks! You can r=me after deleting the crashes test (which looks like the exact issue this PR correctly addresses :3)

@jieyouxu jieyouxu assigned jieyouxu and unassigned fmease Nov 18, 2024
@jieyouxu jieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2024
@RalfJung
Copy link
Member Author

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Nov 18, 2024

📌 Commit 2af9273 has been approved by jieyouxu

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2024
interpret: do not ICE when a promoted fails with OOM

Fixes rust-lang#130687
@bors
Copy link
Contributor

bors commented Nov 18, 2024

⌛ Testing commit 2af9273 with merge 2b10cd1...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 18, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 18, 2024
@RalfJung
Copy link
Member Author

Looks like we don't have graceful OOM handling on macOS

2024-11-18T12:44:07.5906800Z error: Error: expected failure status (Some(1)) but received status None.
2024-11-18T12:44:07.5907300Z status: signal: 9 (SIGKILL)

@RalfJung
Copy link
Member Author

@bors r=jieyouxu rollup=iffy

@bors
Copy link
Contributor

bors commented Nov 18, 2024

📌 Commit 12d7fd8 has been approved by jieyouxu

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 Nov 18, 2024
@bors
Copy link
Contributor

bors commented Nov 18, 2024

⌛ Testing commit 12d7fd8 with merge 7413c9a...

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 18, 2024
@RalfJung
Copy link
Member Author

RalfJung commented Nov 18, 2024 via email

@jieyouxu
Copy link
Member

jieyouxu commented Nov 18, 2024

@RalfJung those look like post-PGO dist tests. AFAIK those are not enabled in PR CI, not without unsetting DIST_TRY_BUILD=1 cc https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Which.20tests.20are.20exercised.20when.20job.20is.20ran.20as.20arbitrary.20try.3F

@jieyouxu
Copy link
Member

It's not immediately obvious why that would fail in post opt-dist when it didn't fail in stage2 tests though... cc @Kobzol do you have any guesses?

@jnkr-ifx
Copy link

jnkr-ifx commented Nov 18, 2024

I see that the dist test has rust.jemalloc enabled in the RUST_CONFIGURE_ARGS while the PR CI does not; could that be the reason for the difference?

The test is failing with a SIGKILL instead of an expected compiler error; indicating the kernel overcommitted the huge allocation, and then OOM-killed the process when it actually tried to access the whole thing.

On my system, jemalloc calls mmap with MAP_NORESERVE which forces overcommit; while glibc malloc does not.

@RalfJung
Copy link
Member Author

But the actually distributed rustc does gracefully handle this allocation failure... playground doesn't SIGKILL.

@RalfJung
Copy link
Member Author

We also have another test triggering this OOM at tests/ui/consts/large_const_alloc.rs, which is enabled on all targets (including macOS). I have no idea why it would fail in this new test.

@jnkr-ifx
Copy link

It SIGKILLs for me on my local machine, using the latest stable & nightly compilers installed through rustup. It also SIGKILLs on Godbolt: https://rust.godbolt.org/z/ThsnaGfKW

Perhaps the playground has overcommit disabled?

@RalfJung
Copy link
Member Author

I can try using the exact same size as the other test.

@RalfJung
Copy link
Member Author

@bors try

@RalfJung
Copy link
Member Author

It SIGKILLs for me on my local machine, using the latest stable & nightly compilers installed through rustup.

It shows the nice error (and the ICE) on my machine, using nightly installed via rustup. 🤷

@bors
Copy link
Contributor

bors commented Nov 18, 2024

⌛ Trying commit c697434 with merge 5b858c9...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 18, 2024
interpret: do not ICE when a promoted fails with OOM

Fixes rust-lang#130687

try-job: aarch64-apple
try-job: dist-x86_64-linux
@RalfJung
Copy link
Member Author

Oh wait I was testing the (1 << 47) - 1 version. That one shows the nice error. The usize::MAX >> 20 version SIGKILLs for me as well. What the...

@jnkr-ifx
Copy link

jnkr-ifx commented Nov 18, 2024

Yeah, looks like the difference in allocation size is all that's needed to trigger the difference in behavior. strace says usize::MAX >> 20 tries to allocate 20 TiB which succeeds due to overcommit and MAP_NORESERVE; but (1 << 47) - 1 is 128 TiB, which the kernel refuses (maybe due to virtual address space exhaustion?)

@RalfJung
Copy link
Member Author

Yeah something like that.

Let's see if the try builds succeed now (they really should, since this is basically identical to the existing test), then we can land this.

@bors
Copy link
Contributor

bors commented Nov 18, 2024

☀️ Try build successful - checks-actions
Build commit: 5b858c9 (5b858c9f9d756116971e80ef44d78f0d7a95a68d)

@RalfJung
Copy link
Member Author

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Nov 18, 2024

📌 Commit c697434 has been approved by jieyouxu

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 Nov 18, 2024
@bors
Copy link
Contributor

bors commented Nov 19, 2024

⌛ Testing commit c697434 with merge 89b6885...

@bors
Copy link
Contributor

bors commented Nov 19, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing 89b6885 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 19, 2024
@bors bors merged commit 89b6885 into rust-lang:master Nov 19, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 19, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (89b6885): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 2.3%, secondary -2.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.3% [0.8%, 3.9%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) 2.3% [0.8%, 3.9%] 2

Cycles

Results (secondary -2.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 795.261s -> 794.555s (-0.09%)
Artifact size: 335.30 MiB -> 335.29 MiB (-0.00%)

@RalfJung RalfJung deleted the promoted-oom branch November 20, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: interpret const eval failure of Unevaluated(UnevaluatedConst
8 participants