-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[C++] logging factory should be stored as static shared_ptr #7132
Merged
Conversation
This file contains 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
C++ references and thus cleans up all statics on exit. This can happen when there are still threads active. If a thread tries to access logging when the process is shutting down, this will possibly use a dead object and corrupt the heap, triggering a segfault. The solution is to make the logger factory immortal. Once it is set, it is assigned to an atomic static pointer, and this object is thereafter never cleaned up. This does change the signature for passing in logger factories, as shared_ptr is no longer valid.
merlimat
requested review from
ivankelly,
sijie,
srkukarni,
jerrypeng,
aahmed-se and
codelipenghui
June 1, 2020 19:07
aahmed-se
approved these changes
Jun 2, 2020
huangdx0726
pushed a commit
to huangdx0726/pulsar
that referenced
this pull request
Aug 24, 2020
) C++ references and thus cleans up all statics on exit. This can happen when there are still threads active. If a thread tries to access logging when the process is shutting down, this will possibly use a dead object and corrupt the heap, triggering a segfault. The solution is to make the logger factory immortal. Once it is set, it is assigned to an atomic static pointer, and this object is thereafter never cleaned up. This does change the signature for passing in logger factories, as shared_ptr is no longer valid. Co-authored-by: Ivan Kelly <ikelly@splunk.com>
1 task
jiazhai
pushed a commit
that referenced
this pull request
Sep 10, 2020
#7932) ### Motivation I want to use custom logging factory in cpp client ### Modifications #7132 broke custom logger config option. It then was identified in #7503 (and #7502) but not fixed. This PR actually fixes it by checking the right variable name. ### Verifying this change This change is a trivial rework / code cleanup without any test coverage. ### Documentation This PR does not introduce any new functionality, but it fixes existing functionality that presumably is already documented. * Fix for not respecting custom LoggerFactory client config * Add Custom Logger Factory Test * revert threads used by make in docker-build Co-authored-by: Stepan Mazurov <smazurov@quantummetric.com>
lbenc135
pushed a commit
to lbenc135/pulsar
that referenced
this pull request
Oct 3, 2020
apache#7932) ### Motivation I want to use custom logging factory in cpp client ### Modifications apache#7132 broke custom logger config option. It then was identified in apache#7503 (and apache#7502) but not fixed. This PR actually fixes it by checking the right variable name. ### Verifying this change This change is a trivial rework / code cleanup without any test coverage. ### Documentation This PR does not introduce any new functionality, but it fixes existing functionality that presumably is already documented. * Fix for not respecting custom LoggerFactory client config * Add Custom Logger Factory Test * revert threads used by make in docker-build Co-authored-by: Stepan Mazurov <smazurov@quantummetric.com>
astifter
pushed a commit
to astifter/pulsar
that referenced
this pull request
Apr 7, 2021
With issue apache#7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>.
astifter
pushed a commit
to astifter/pulsar
that referenced
this pull request
Apr 29, 2021
With issue apache#7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>.
yangl
pushed a commit
to yangl/pulsar
that referenced
this pull request
Jun 23, 2021
Fixes apache#10161. ### Motivation With issue apache#7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>.
codelipenghui
pushed a commit
that referenced
this pull request
Jun 26, 2021
Fixes #10161. ### Motivation With issue #7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>. (cherry picked from commit d700f8d)
bharanic-dev
pushed a commit
to bharanic-dev/pulsar
that referenced
this pull request
Mar 18, 2022
Fixes apache#10161. ### Motivation With issue apache#7132 the LoggerFactoryPtr was removed in favour of relevant memory-safe(r) pointers. This change forgot to also change the Log4Cxx implementation, fix this by returning (as with the other LoggerFactory's) a std::unique_ptr<LoggerFactory>.
2 tasks
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.
Motivation
C++ references and thus cleans up all statics on exit. This can happen
when there are still threads active. If a thread tries to access
logging when the process is shutting down, this will possibly use a
dead object and corrupt the heap, triggering a segfault.
The solution is to make the logger factory immortal. Once it is set,
it is assigned to an atomic static pointer, and this object is
thereafter never cleaned up. This does change the signature for
passing in logger factories, as shared_ptr is no longer valid.