Skip to content

Commit 37031fe

Browse files
authored
fix: deadlock (#43)
* fix: deadlock fix deadlocks: 1. exclusive lock was not `Send` but unsafe impled. 2. submit flush task await blocks `set_region_evictable` 3. no new reclamation task created after `set_region_evctable` if all write process are waiting Signed-off-by: MrCroxx <[email protected]> * update ci Signed-off-by: MrCroxx <[email protected]> --------- Signed-off-by: MrCroxx <[email protected]>
1 parent cc5fc2d commit 37031fe

File tree

14 files changed

+1019
-386
lines changed

14 files changed

+1019
-386
lines changed

.github/template/template.yml

+34-3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,37 @@ jobs:
7070
run: |
7171
cargo llvm-cov nextest --lcov --output-path lcov.info
7272
- uses: codecov/codecov-action@v2
73+
deadlock:
74+
name: run with single worker thread and deadlock detection
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v3
79+
- name: Install rust toolchain@v1
80+
uses: actions-rs/toolchain@v1
81+
with:
82+
toolchain: ${{ env.RUST_TOOLCHAIN }}
83+
# components: rustfmt, clippy, llvm-tools-preview
84+
- name: Cache Cargo home
85+
uses: actions/cache@v2
86+
id: cache
87+
with:
88+
path: |
89+
~/.cargo/bin/
90+
~/.cargo/registry/index/
91+
~/.cargo/registry/cache/
92+
~/.cargo/git/db/
93+
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}-${{ env.CACHE_KEY_SUFFIX }}
94+
- name: Run foyer-storage-bench with single worker thread and deadlock detection
95+
env:
96+
RUST_BACKTRACE: 1
97+
RUSTFLAGS: '--cfg tokio_unstable'
98+
RUST_LOG: info
99+
TOKIO_WORKER_THREADS: 1
100+
run: |-
101+
cargo build --all --features deadlock &&
102+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock &&
103+
timeout 2m ./target/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60
73104
asan:
74105
name: run with address saniziter
75106
runs-on: ubuntu-latest
@@ -95,8 +126,8 @@ jobs:
95126
env:
96127
RUST_BACKTRACE: 1
97128
RUSTFLAGS: '-Zsanitizer=address --cfg tokio_unstable'
98-
EXTRA_CARGO_ARGS: '--verbose -Zbuild-std --target x86_64-unknown-linux-gnu'
129+
RUST_LOG: info
99130
run: |-
100131
cargo build --all --target x86_64-unknown-linux-gnu &&
101-
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench &&
102-
./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000
132+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan &&
133+
timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60

.github/workflows/main.yml

+33-3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,36 @@ jobs:
7777
run: |
7878
cargo llvm-cov nextest --lcov --output-path lcov.info
7979
- uses: codecov/codecov-action@v2
80+
deadlock:
81+
name: run with single worker thread and deadlock detection
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v3
86+
- name: Install rust toolchain@v1
87+
uses: actions-rs/toolchain@v1
88+
with:
89+
toolchain: ${{ env.RUST_TOOLCHAIN }}
90+
- name: Cache Cargo home
91+
uses: actions/cache@v2
92+
id: cache
93+
with:
94+
path: |
95+
~/.cargo/bin/
96+
~/.cargo/registry/index/
97+
~/.cargo/registry/cache/
98+
~/.cargo/git/db/
99+
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}-${{ env.CACHE_KEY_SUFFIX }}
100+
- name: Run foyer-storage-bench with single worker thread and deadlock detection
101+
env:
102+
RUST_BACKTRACE: 1
103+
RUSTFLAGS: '--cfg tokio_unstable'
104+
RUST_LOG: info
105+
TOKIO_WORKER_THREADS: 1
106+
run: |-
107+
cargo build --all --features deadlock &&
108+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock &&
109+
timeout 2m ./target/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60
80110
asan:
81111
name: run with address saniziter
82112
runs-on: ubuntu-latest
@@ -101,11 +131,11 @@ jobs:
101131
env:
102132
RUST_BACKTRACE: 1
103133
RUSTFLAGS: '-Zsanitizer=address --cfg tokio_unstable'
104-
EXTRA_CARGO_ARGS: '--verbose -Zbuild-std --target x86_64-unknown-linux-gnu'
134+
RUST_LOG: info
105135
run: |-
106136
cargo build --all --target x86_64-unknown-linux-gnu &&
107-
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench &&
108-
./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000
137+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan &&
138+
timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60
109139
110140
# ================= THIS FILE IS AUTOMATICALLY GENERATED =================
111141
#

.github/workflows/pull-request.yml

+33-3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,36 @@ jobs:
7676
run: |
7777
cargo llvm-cov nextest --lcov --output-path lcov.info
7878
- uses: codecov/codecov-action@v2
79+
deadlock:
80+
name: run with single worker thread and deadlock detection
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v3
85+
- name: Install rust toolchain@v1
86+
uses: actions-rs/toolchain@v1
87+
with:
88+
toolchain: ${{ env.RUST_TOOLCHAIN }}
89+
- name: Cache Cargo home
90+
uses: actions/cache@v2
91+
id: cache
92+
with:
93+
path: |
94+
~/.cargo/bin/
95+
~/.cargo/registry/index/
96+
~/.cargo/registry/cache/
97+
~/.cargo/git/db/
98+
key: ${{ runner.os }}-cargo-asan-${{ hashFiles('**/Cargo.lock') }}-${{ env.CACHE_KEY_SUFFIX }}
99+
- name: Run foyer-storage-bench with single worker thread and deadlock detection
100+
env:
101+
RUST_BACKTRACE: 1
102+
RUSTFLAGS: '--cfg tokio_unstable'
103+
RUST_LOG: info
104+
TOKIO_WORKER_THREADS: 1
105+
run: |-
106+
cargo build --all --features deadlock &&
107+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock &&
108+
timeout 2m ./target/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/deadlock --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60
79109
asan:
80110
name: run with address saniziter
81111
runs-on: ubuntu-latest
@@ -100,11 +130,11 @@ jobs:
100130
env:
101131
RUST_BACKTRACE: 1
102132
RUSTFLAGS: '-Zsanitizer=address --cfg tokio_unstable'
103-
EXTRA_CARGO_ARGS: '--verbose -Zbuild-std --target x86_64-unknown-linux-gnu'
133+
RUST_LOG: info
104134
run: |-
105135
cargo build --all --target x86_64-unknown-linux-gnu &&
106-
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench &&
107-
./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000
136+
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan &&
137+
timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-storage-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-storage-bench/asan --capacity 256 --region-size 16 --buffer-pool-size 256 --lookup-range 1000 --time 60
108138
concurrency:
109139
group: environment-${{ github.ref }}
110140
cancel-in-progress: true

0 commit comments

Comments
 (0)