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

waiting until all the callbacks are done before stopping #497

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

JacksonYao287
Copy link
Contributor

before stopping logdev, we should wait until all the callbacks are done to avoid memroy leak

xiaoxichen
xiaoxichen previously approved these changes Aug 14, 2024
Copy link
Collaborator

@xiaoxichen xiaoxichen left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -500,8 +500,12 @@ class SampleDB {
}

void on_log_insert_completion(logdev_id_t fid, logstore_seq_num_t lsn, logdev_key ld_key) {
if (m_highest_log_idx.count(fid) == 0) { m_highest_log_idx[fid] = std::atomic{-1}; }
atomic_update_max(m_highest_log_idx[fid], ld_key.idx);
{
Copy link
Contributor Author

@JacksonYao287 JacksonYao287 Aug 14, 2024

Choose a reason for hiding this comment

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

many on_log_insert_completion might be executed in different reactors (threads). theoretically, different threads might modify and access m_highest_log_idx concurrently , which might cause a segfault . so add a lock here

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to add lock also to

logid_t highest_log_idx(logdev_id_t fid) {

xiaoxichen
xiaoxichen previously approved these changes Aug 14, 2024
@xiaoxichen xiaoxichen merged commit 2fa025e into eBay:master Aug 14, 2024
21 checks passed
@JacksonYao287 JacksonYao287 deleted the waiting-callback branch August 21, 2024 08:05
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.

2 participants