Skip to content

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Mar 15, 2024

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and operator new isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ std::new_handler.

Fixes #121305
Cc llvm/llvm-project#85281
r? @nikic

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.
@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 Mar 15, 2024
@rust-log-analyzer

This comment has been minimized.

@cuviper
Copy link
Member Author

cuviper commented Mar 15, 2024

Oops, the bad-alloc installer had its assertion fixed in llvm/llvm-project#83160 -- but I think it will work if we just register that before the fatal error handler...

cuviper added 2 commits March 15, 2024 16:48
The bad-alloc installer was incorrectly asserting that the other handler
isn't set yet, instead of checking its own, but we can avoid that by
changing the order we install them.

Ref: llvm/llvm-project#83040
@nikic
Copy link
Contributor

nikic commented Mar 16, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 16, 2024

📌 Commit 8d374b1 has been approved by nikic

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 Mar 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 16, 2024
Register LLVM handlers for bad-alloc / OOM

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.

Fixes rust-lang#121305
Cc llvm/llvm-project#85281
r? `@nikic`
@bors
Copy link
Collaborator

bors commented Mar 16, 2024

⌛ Testing commit 8d374b1 with merge 553506a...

@rust-log-analyzer
Copy link
Collaborator

The job armhf-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [ui] tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs#default stdout ----

error in revision `default`: test run failed!
command: RUST_TEST_THREADS="8" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/remote-test-client" "run" "0" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default/a"
--- stdout -------------------------------
uploaded "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfcs/rfc-2091-track-caller/std-panic-locations.default/a", waiting for result
------------------------------------------

@bors
Copy link
Collaborator

bors commented Mar 16, 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 Mar 16, 2024
@cuviper
Copy link
Member Author

cuviper commented Mar 16, 2024

"Connection reset" in remote-test-client

@bors retry

@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 Mar 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 17, 2024
Register LLVM handlers for bad-alloc / OOM

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.

Fixes rust-lang#121305
Cc llvm/llvm-project#85281
r? `@nikic`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#119411 (Add as_(mut_)ptr and as_(mut_)slice to raw array pointers)
 - rust-lang#122248 (Respect stage0 sysroot when compiling rmake.rs with COMPILETEST_FORCE_STAGE0)
 - rust-lang#122295 (mir-opt: always run tests for the current target)
 - rust-lang#122574 (Register LLVM handlers for bad-alloc / OOM)
 - rust-lang#122608 (Move check-cfg diagnostic logic into a separate file)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 33b4ed2 into rust-lang:master Mar 17, 2024
@rustbot rustbot added this to the 1.79.0 milestone Mar 17, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2024
Rollup merge of rust-lang#122574 - cuviper:llvm-oom, r=nikic

Register LLVM handlers for bad-alloc / OOM

LLVM's default bad-alloc handler may throw if exceptions are enabled,
and `operator new` isn't hooked at all by default. Now we register our
own handler that prints a message similar to fatal errors, then aborts.
We also call the function that registers the C++ `std::new_handler`.

Fixes rust-lang#121305
Cc llvm/llvm-project#85281
r? ``@nikic``
@cuviper cuviper deleted the llvm-oom branch April 11, 2024 16:05
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-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.

error: rustc interrupted by SIGSEGV -- i686 OOM
5 participants