Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fuzz): fuzz with random multithreaded reads for accountsdb #552

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Sobeston
Copy link
Contributor

@Sobeston Sobeston commented Feb 7, 2025

Rebased #532 to target main

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

see 2 files with indirect coverage changes

@@ -145,6 +155,17 @@ pub fn run(seed: u64, args: *std.process.ArgIterator) !void {
var pubkeys_this_slot = std.AutoHashMap(Pubkey, void).init(allocator);
defer pubkeys_this_slot.deinit();

for (0..8) |i| {
_ = try std.Thread.spawn(.{}, readRandomAccountThread, .{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should .detach() the thread handles to avoid leaking their resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 972fb91

@Sobeston Sobeston requested a review from kprotty February 24, 2025 23:57
@Sobeston Sobeston force-pushed the sobe/accountsdb/multithread-fuzz-2 branch from d58a6c9 to 972fb91 Compare February 25, 2025 00:39
defer tracked_accounts_lg.unlock();
tracked_accounts.deinit();

for (threads[0..spawned_threads]) |thread| thread.join();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should prob join threads outside the writeLock to avoid a deadlock: reader misses alive, goes to readLock; writer alive=false, writeLocks, waits on reader to join; reader readLock is waiting on writer writeLock

Maybe move the defer { alive=false; join threads } after the defer deinit. Could also get rid of the errdefer detach(); spawned = 0 down below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants