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

glog: fix chunkserver exit with core #424

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Conversation

ilixiaocui
Copy link
Contributor

@ilixiaocui ilixiaocui commented Jul 9, 2021

What problem does this PR solve?

chunkserver will exit with core dump when receive SIGINT

Issue Number: close #425

Problem Summary:

  1. we compile a debug version, and locate abort() as follwing:
    image

  2. abort happens when destruct (static bthread::TimerThread timer_) in curve::common::LeakyBucket.
    The lifecycle of static member variable in class is the same as process
    image

  3. bthread::TimerThread destruct with run() exit. run() need log print before exit.
    image

  4. log print need get vmodule_lock, which is a globle static variable
    image

  5. globle static variable and class static member variable are both detruct before process exit. But the order of their destruction is determined by the compiler. If vmodule_lock destruct before bthread::TimerThread, the process will core dump

What is changed and how it works?

What's Changed:

change static Mutex vmodule_lock -> static Mutex* vmodule_lock = new Mutex();

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

};

// This protects the following global variables.
-static Mutex vmodule_lock;
Copy link
Contributor

Choose a reason for hiding this comment

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

there's exists more than one global Mutex, you should check whether the same problem will happen on other global Mutex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ilixiaocui
Copy link
Contributor Author

recheck

@YunhuiChen YunhuiChen merged commit 34ad43b into opencurve:master Jul 12, 2021
ilixiaocui pushed a commit to ilixiaocui/curve that referenced this pull request Feb 6, 2023
…l-fall-2021

Add project for upgrade/downgrade testing to LFX fall term
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.

chunkserver will exit with core dump when receive SIGINT
3 participants