Skip to content

Commit bb0928e

Browse files
authored
Infra: Disable buggy LTO and add smoke tests to CI (#320)
Fixes marker_rustc_driver crashing on windows with `exit code: 0xc0000005, STATUS_ACCESS_VIOLATION`. Reported in #318 (comment). I disabled LTO, in release build and it fixes the problem. I extended the CI to perform a really simple release smoke test both for the current release and for the previous release (in github action test CI job). Here, for example, you may see that the bug reproduces in master on the changed CI - [CI job for the current version of marker](https://github.com/rust-marker/marker/actions/runs/6985541482/job/19009920759?pr=320#step:4:93) - [CI job for the released version of marker](https://github.com/rust-marker/marker/actions/runs/6985541482/job/19009920759?pr=320#step:4:93) With the disabled LTO `release-smoke-test` [passes](https://github.com/rust-marker/marker/actions/runs/6985586586/job/19010007386?pr=320) Btw. @xFrednet could you add the `release-smoke-test` jobs to required ones please?
1 parent 05727a8 commit bb0928e

File tree

4 files changed

+60
-12
lines changed

4 files changed

+60
-12
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
runs-on: ${{ matrix.os }}-latest
3232

3333
strategy:
34+
fail-fast: false
3435
matrix:
3536
os: [ubuntu, windows, macos]
3637

@@ -45,6 +46,7 @@ jobs:
4546
runs-on: ${{ matrix.os }}-latest
4647

4748
strategy:
49+
fail-fast: false
4850
matrix:
4951
os: [ubuntu, windows, macos]
5052

@@ -100,6 +102,7 @@ jobs:
100102
runs-on: ${{ matrix.os }}-latest
101103

102104
strategy:
105+
fail-fast: false
103106
matrix:
104107
os: [ubuntu, windows, macos]
105108

@@ -166,11 +169,30 @@ jobs:
166169
# Check that the release automation works as expected
167170
- run: scripts/release/test.sh
168171

172+
# This job performs a really simple smoke test that the release build of our binaries
173+
# works well. We had to introduce this job after we saw that the release build on windows
174+
# couldn't even work without crashing with exit code: 0xc0000005, STATUS_ACCESS_VIOLATION
175+
# due to some bug in LTO.
176+
release-smoke-test:
177+
runs-on: ${{ matrix.os }}-latest
178+
179+
strategy:
180+
fail-fast: false
181+
matrix:
182+
os: [ubuntu, windows, macos]
183+
184+
steps:
185+
- uses: actions/checkout@v4
186+
187+
- run: MARKER_ALLOW_DRIVER_BUILD=1 cargo build -p cargo_marker -p marker_rustc_driver --release
188+
- run: PATH="$PWD/target/release:$PATH" cargo marker
189+
169190
# Check that the Github Action works
170191
github-action-test:
171192
runs-on: ${{ matrix.os }}
172193

173194
strategy:
195+
fail-fast: false
174196
matrix:
175197
# Make sure we cover all operating systems supported by Github Actions
176198
os:
@@ -207,3 +229,8 @@ jobs:
207229
# +stable is to force using the pre-installed `cargo` on the runner instead of
208230
# what's specified in `rust-toolchain.toml`
209231
- run: cargo +stable marker --version
232+
233+
# There may be bugs in the release build of our binaries. For example, in the past
234+
# we saw that LTO could lead to exit code: 0xc0000005, STATUS_ACCESS_VIOLATION crash
235+
236+
- run: cargo marker -l 'marker_lints="*"'

.github/workflows/release-on-tag.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ jobs:
128128
env:
129129
artifact: marker_rustc_driver-aarch64-unknown-linux-gnu
130130

131+
# We've seen this job hang for 6 hours with the logs ending with
132+
# ```
133+
# Compiling libloading v0.8.0
134+
# Compiling bumpalo v3.14.0
135+
# Error: The operation was canceled.
136+
# ```
137+
#
138+
# No idea how that happens. Maybe that's a bug with the compiler hang in rustc,
139+
# but this bug seems flaky, and reruning the job if it hangs should help
140+
timeout-minutes: 60
141+
131142
steps:
132143
- uses: actions/checkout@v4
133144

@@ -175,17 +186,19 @@ jobs:
175186
# For extra security we set the env variable with the token only
176187
# for the steps that require them.
177188
#
178-
# There are two `cargo release` invocations here. One without the
179-
# `cargo_marker` package, and one with it.
180-
#
181-
# Keep in mind that `cargo-marker` may install `marker_rustc_driver`
182-
# from crates.io via `cargo install`.
189+
# We used to have two `cargo release` invocations here. One without the
190+
# `cargo_marker` package, and one with it. This was done because there is
191+
# an implicit dependency between `cargo_marker` and `marker_rustc_driver`,
192+
# since the former installs the latter. However, this separation somehow
193+
# resulted in the second `cargo release` invocation to fail with the error
194+
# ```
195+
# the remote server responded with an error (status 403 Forbidden):
196+
# must be logged in to perform that action
197+
# ```
183198
#
184-
# That being said, we will be extra safe if `cargo_marker` is published
185-
# after `marker_rustc_driver`.
186-
- run: cargo release publish --exclude cargo_marker --execute --no-confirm --no-verify --allow-branch '*'
187-
env:
188-
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
189-
- run: cargo release publish --package cargo_marker --execute --no-confirm --no-verify --allow-branch '*'
199+
# No idea why this happens, but let's just keep a single cargo release
200+
# to avoid this issue and to simplify the workflow, because the problem
201+
# we tried to protect against is not that likely to happen anyway.
202+
- run: cargo release publish --no-confirm --no-verify --no-push --no-tag --allow-branch '*'
190203
env:
191204
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ The following components are considered to be internal and they are excluded fro
2424

2525
## [Unreleased]
2626

27+
## [0.4.2] - 2023-11-25
28+
29+
[#320]: https://github.com/rust-marker/marker/pull/320
30+
31+
- [#320]: Disable LTO on release builds to fix the crash on Windows with `exit code: 0xc0000005, STATUS_ACCESS_VIOLATION`
32+
2733
## [0.4.1] - 2023-11-24
2834

2935
[#319]: https://github.com/rust-marker/marker/pull/319

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ resolver = "2"
1313

1414
[profile.release]
1515
codegen-units = 1
16-
lto = true
1716
strip = false
1817

18+
# ⚠️ Turns out there is some bug in LTO on Windows, because it leads to the
19+
# `marker_rustc_driver` crashing with "exit code: 0xc0000005, STATUS_ACCESS_VIOLATION"
20+
lto = false
1921

2022
[workspace.package]
2123
edition = "2021"

0 commit comments

Comments
 (0)