Better handling of fatal errors#46846
Merged
alexey-milovidov merged 1 commit intomasterfrom Feb 25, 2023
Merged
Conversation
| /// It is important to destroy query context here. We do not want it to live arbitrarily longer than the query. | ||
| query_context.reset(); | ||
|
|
||
| CurrentThread::setFatalErrorCallback({}); |
Member
Author
There was a problem hiding this comment.
We reset the callback before the destruction of TCPHandler.
|
|
||
| void ThreadStatus::onFatalError() | ||
| { | ||
| std::lock_guard lock(thread_group->mutex); |
Member
Author
There was a problem hiding this comment.
This allows it to be reset.
| if (sig != SIGTSTP) /// This signal is used for debugging. | ||
| { | ||
| /// The time that is usually enough for separate thread to print info into log. | ||
| sleepForSeconds(20); /// FIXME: use some feedback from threads that process stacktrace |
Member
Author
There was a problem hiding this comment.
Implement TODO.
The logs will be sent to the client in more cases.
Member
Author
|
I didn't reproduce the case, but it should become better. |
tavplubix
reviewed
Feb 26, 2023
| } | ||
|
|
||
|
|
||
| static std::atomic<bool> fatal_error_printed{false}; |
Member
There was a problem hiding this comment.
It's not quite correct to use std::atomic in a signal handler, it would be better to use std::atomic_flag. However, I doubt someone actually uses ClickHouse on architectures where it matters.
tavplubix
reviewed
Mar 2, 2023
|
|
||
| void ThreadStatus::onFatalError() | ||
| { | ||
| std::lock_guard lock(thread_group->mutex); |
Member
There was a problem hiding this comment.
yokofly
added a commit
to timeplus-io/proton
that referenced
this pull request
Mar 4, 2024
porting ClickHouse/ClickHouse#46846 on Feb 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
This closes #37889.