-
Notifications
You must be signed in to change notification settings - Fork 42
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ |
src/accountsdb/fuzz.zig
Outdated
@@ -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, .{ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 972fb91
d58a6c9
to
972fb91
Compare
defer tracked_accounts_lg.unlock(); | ||
tracked_accounts.deinit(); | ||
|
||
for (threads[0..spawned_threads]) |thread| thread.join(); |
There was a problem hiding this comment.
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.
Rebased #532 to target main