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

funk locking fixes #3908

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

two-heart
Copy link
Collaborator

None of these really a problem in their respective contexts, but good to have all code do correct locking, if only for automated tooling.

@two-heart two-heart requested a review from mjain-jump January 9, 2025 15:51
@@ -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 );
Copy link
Member

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

Copy link
Collaborator Author

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 );
Copy link
Member

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

Copy link
Collaborator Author

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.

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

Successfully merging this pull request may close these issues.

3 participants