Skip to content

Commit

Permalink
Relax rwlock test (for CI) (kaspanet#408)
Browse files Browse the repository at this point in the history
* relax rwlock test

* fix tn11 disk requirements based on actual network load
  • Loading branch information
michaelsutton authored and KashProtocol committed Feb 26, 2024
1 parent 088f826 commit 7359966
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/testnet11.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Since we want the test condition to be as close as possible to organic, we encou

The venue for discussing and monitoring the experiment will be the \#testnet channel on Discord. We encourage participants to describe the experience in general, and also tell us what hardware they are using and how well it handles the load.

The recommended hardware requirements are 16GB of RAM, preferably a CPU with at least 8 cores, and an SSD drive with at least 100GB of free space (the 150GB for a safety margin is preferable). It might also be possible to operate with 8GB of RAM, by passing the `--ram-scale=0.6` parameter to `kashd`.
The recommended hardware requirements are 16GB of RAM, preferably a CPU with at least 8 cores, and an SSD drive with at least 250GB of free space (the 300GB for a safety margin is preferable). It might also be possible to operate with 8GB of RAM, by passing the `--ram-scale=0.6` parameter to `kashd`.

## Setup Instructions

Expand Down
6 changes: 3 additions & 3 deletions utils/src/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ mod tests {

#[tokio::test]
async fn test_writer_reentrance() {
for i in 0..64 {
for i in 0..16 {
let l = Arc::new(RfRwLock::new());
let (tx, rx) = oneshot::channel();
let l_clone = l.clone();
let h = std::thread::spawn(move || {
let mut write = l_clone.blocking_write();
tx.send(()).unwrap();
for _ in 0..5 {
for _ in 0..10 {
std::thread::sleep(Duration::from_millis(2));
write.blocking_yield();
}
});
rx.await.unwrap();
// Make sure the reader acquires the lock during writer yields. We give the test a few chances to acquire
// in order to make sure it passes also in slow CI environments where the OS thread-scheduler might take its time
let read = timeout(Duration::from_millis(5), l.read()).await.unwrap_or_else(|_| panic!("failed at iteration {i}"));
let read = timeout(Duration::from_millis(18), l.read()).await.unwrap_or_else(|_| panic!("failed at iteration {i}"));
drop(read);
timeout(Duration::from_millis(100), tokio::task::spawn_blocking(move || h.join())).await.unwrap().unwrap().unwrap();
}
Expand Down

0 comments on commit 7359966

Please sign in to comment.