Skip to content

Commit cdfca0f

Browse files
Work around TSAN ASLR issue in CI (project-chip#32567)
* Work around TSAN ASLR issue * Simplify action condition --------- Co-authored-by: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com>
1 parent c90481f commit cdfca0f

File tree

2 files changed

+42
-37
lines changed

2 files changed

+42
-37
lines changed

.github/actions/checkout-submodules-and-bootstrap/action.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,10 @@ runs:
4141
uses: ./.github/actions/upload-bootstrap-logs
4242
with:
4343
bootstrap-log-name: ${{ inputs.bootstrap-log-name }}
44+
- name: Work around TSAN ASLR issues
45+
if: runner.os == 'Linux' && !env.ACT
46+
shell: bash
47+
run: |
48+
# See https://stackoverflow.com/a/77856955/2365113
49+
if [[ "$UID" == 0 ]]; then function sudo() { "$@"; }; fi
50+
sudo sysctl vm.mmap_rnd_bits=28

.github/actions/maximize-runner-disk/action.yaml

+35-37
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,45 @@ runs:
44
using: "composite"
55
steps:
66
- name: Free up disk space on the github runner
7-
if: ${{ !env.ACT }}
7+
if: runner.os == 'Linux' && !env.ACT
88
shell: bash
99
run: |
1010
# maximize-runner-disk
11-
if [[ "$RUNNER_OS" == Linux ]]; then
12-
# Directories to prune to free up space. Candidates:
13-
# 1.6G /usr/share/dotnet
14-
# 1.1G /usr/local/lib/android/sdk/platforms
15-
# 1000M /usr/local/lib/android/sdk/build-tools
16-
# 8.9G /usr/local/lib/android/sdk
17-
# This list can be amended later to change the trade-off between the amount of
18-
# disk space freed up, and how long it takes to do so (deleting many files is slow).
19-
prune=(/usr/share/dotnet /usr/local/lib/android/sdk/platforms /usr/local/lib/android/sdk/build-tools)
11+
# Directories to prune to free up space. Candidates:
12+
# 1.6G /usr/share/dotnet
13+
# 1.1G /usr/local/lib/android/sdk/platforms
14+
# 1000M /usr/local/lib/android/sdk/build-tools
15+
# 8.9G /usr/local/lib/android/sdk
16+
# This list can be amended later to change the trade-off between the amount of
17+
# disk space freed up, and how long it takes to do so (deleting many files is slow).
18+
prune=(/usr/share/dotnet /usr/local/lib/android/sdk/platforms /usr/local/lib/android/sdk/build-tools)
2019
21-
if [[ "$UID" -eq 0 && -d /__w ]]; then
22-
root=/runner-root-volume
23-
if [[ ! -d "$root" ]]; then
24-
echo "Unable to maximize disk space, job is running inside a container and $root is not mounted"
25-
exit 0
26-
fi
27-
function sudo() { "$@"; } # we're already root (and sudo is probably unavailable)
28-
elif [[ "$UID" -ne 0 && "$RUNNER_ENVIRONMENT" == github-hosted ]]; then
29-
root=
30-
else
31-
echo "Unable to maximize disk space, unknown runner environment"
20+
if [[ "$UID" -eq 0 && -d /__w ]]; then
21+
root=/runner-root-volume
22+
if [[ ! -d "$root" ]]; then
23+
echo "Unable to maximize disk space, job is running inside a container and $root is not mounted"
3224
exit 0
3325
fi
34-
35-
echo "Freeing up runner disk space on ${root:-/}"
36-
function avail() { df -k --output=avail "${root:-/}" | grep '^[0-9]*$'; }
37-
function now() { date '+%s'; }
38-
before="$(avail)" start="$(now)"
39-
for dir in "${prune[@]}"; do
40-
if [[ -d "${root}${dir}" ]]; then
41-
echo "- $dir"
42-
# du -sh -- "${root}${dir}"
43-
sudo rm -rf -- "${root}${dir}"
44-
else
45-
echo "- $dir (not found)"
46-
fi
47-
done
48-
after="$(avail)" end="$(now)"
49-
echo "Done, freed up $(( (after - before) / 1024 ))M of disk space in $(( end - start )) seconds."
26+
function sudo() { "$@"; } # we're already root (and sudo is probably unavailable)
27+
elif [[ "$UID" -ne 0 && "$RUNNER_ENVIRONMENT" == github-hosted ]]; then
28+
root=
29+
else
30+
echo "Unable to maximize disk space, unknown runner environment"
31+
exit 0
5032
fi
33+
34+
echo "Freeing up runner disk space on ${root:-/}"
35+
function avail() { df -k --output=avail "${root:-/}" | grep '^[0-9]*$'; }
36+
function now() { date '+%s'; }
37+
before="$(avail)" start="$(now)"
38+
for dir in "${prune[@]}"; do
39+
if [[ -d "${root}${dir}" ]]; then
40+
echo "- $dir"
41+
# du -sh -- "${root}${dir}"
42+
sudo rm -rf -- "${root}${dir}"
43+
else
44+
echo "- $dir (not found)"
45+
fi
46+
done
47+
after="$(avail)" end="$(now)"
48+
echo "Done, freed up $(( (after - before) / 1024 ))M of disk space in $(( end - start )) seconds."

0 commit comments

Comments
 (0)