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

logger: Create only one Context per process for mobile #38188

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abeyad
Copy link
Contributor

@abeyad abeyad commented Jan 25, 2025

The Logger::Context operates as a stack. When a new one is created, it becomes the active Context. When it gets destroyed, the previous Context is popped to become the activate one.

This can lead to lifetime bugs in Envoy Mobile. If multiple engines are created, the destruction of those engines can cause indeterminate destruction of the Logger::Context objects.

In this commit, the behavior is changed so that the Logger::Context initialization in mobile is done one time only, outside of StrippedMainBase. And StrippedMainBase will only initialize a Logger::Context if one is not already active.

The Logger::Context operates as a stack. When a new one is created, it
becomes the active Context. When it gets destroyed, the previous Context
is popped to become the activate one.

This can lead to lifetime bugs in Envoy Mobile. If multiple engines are
created, the destruction of those engines can cause indeterminate
destruction of the Logger::Context objects.

In this commit, the behavior is changed so that the Logger::Context
initialization in mobile is done one time only, outside of
StrippedMainBase. And StrippedMainBase will only initialize a
Logger::Context if one is not already active.

Signed-off-by: Ali Beyad <abeyad@google.com>
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #38188 was opened by abeyad.

see: more, trace.

Signed-off-by: Ali Beyad <abeyad@google.com>
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.

1 participant