-
Notifications
You must be signed in to change notification settings - Fork 11
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
Prevent segfault in casacore log sink destructor #1398
base: dev
Are you sure you want to change the base?
Conversation
… pointer it's not safe to reuse
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.
As stated in the description, these changes solve the reported bug and still send casacore log messages to the carta log for consistent formatting.
src/Main/Main.cc
Outdated
casacore::LogSink::globalSink(carta_log_sink); | ||
casacore::LogIO casacore_log(log_sink); | ||
casacore::LogIO casacore_log; |
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.
LogIO not needed?
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.
Good point; this object is actually never used.
|
Description
This fixes #1382. Testing is required to check if this is still doing the correct thing with casacore logs.
The segfault happens in the shared pointer destructor called from the
casacore::LogSink
destructor. I believe that this is because the shared pointer's underlying pointer is zeroed bycasacore::LogSink::globalSink
when it is used to set the global sink. This PR bypasses this issue by not reusing the same raw pointer both to set the global sink and to create aLogSink
object which theLogIO
object is then attached to. Instead, it uses the defaultLogIO
constructor, which should attach the object to the global sink, which should be set to the correct sink.I tested this locally and it appears that the casacore messages are still being formatted correctly in the output, but I'm not 100% familiar with the way that this logging model is supposed to work.
If there is no regression, I think that this PR is low-risk enough to be included in the freeze, but I'm creating it as a draft first just in case.
Checklist
no changelog update neededprotobuf updated to the latest dev commit/ no protobuf update neededprotobuf version bumped/ protobuf version not bumped