-
Notifications
You must be signed in to change notification settings - Fork 212
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
funk locking fixes #3908
base: main
Are you sure you want to change the base?
funk locking fixes #3908
Conversation
@@ -314,11 +314,10 @@ fd_acc_mgr_save_non_tpool( fd_acc_mgr_t * acc_mgr, | |||
fd_funk_rec_key_t key = fd_acc_funk_key( account->pubkey ); | |||
fd_funk_t * funk = acc_mgr->funk; | |||
fd_funk_rec_t * rec = (fd_funk_rec_t *)fd_funk_rec_query( funk, txn, &key ); |
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.
looks like this needs a read lock
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.
I thought funk allows lock-free read operations. How do I get a read lock for funk?
@@ -330,6 +329,7 @@ fd_acc_mgr_save_non_tpool( fd_acc_mgr_t * acc_mgr, | |||
if( fd_funk_val_truncate( account->rec, reclen, fd_funk_alloc( acc_mgr->funk, wksp ), wksp, &err ) == NULL ) { | |||
FD_LOG_ERR(( "unable to allocate account value, err %d", err )); | |||
} | |||
fd_funk_end_write( acc_mgr->funk ); |
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.
not sure i'm a fan calling LOG_ERR while holding the lock ... funk is now invalid which is an issue for persistent funk
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.
There are tons of cases where we FD_LOG_ERR, while holding a funk lock: fd_runtime_process_genesis_block, fd_migrate_builtin_to_core_bpf, fd_runtime_collect_rent_accounts_prune, and many more. Getting rid of this would be a bigger change, or potentially something we want to do atexit.
None of these really a problem in their respective contexts, but good to have all code do correct locking, if only for automated tooling.