Skip to content

logger: fix lifetime issue of AccessLogConfig in tls callback.#18081

Merged
yanavlasov merged 5 commits intoenvoyproxy:mainfrom
mathetake:access-logger-initialization-
Sep 17, 2021
Merged

logger: fix lifetime issue of AccessLogConfig in tls callback.#18081
yanavlasov merged 5 commits intoenvoyproxy:mainfrom
mathetake:access-logger-initialization-

Conversation

@mathetake
Copy link
Copy Markdown
Member

Signed-off-by: Takeshi Yoneda takeshi@tetrate.io

Commit Message: This commit fixes the lifetime issue of Http/TcpAccessLogConfig owned by HttpGrpcAccessLog and TcpGrpcAccessLog loggers. These logger objects may have died before the thread local callback for initializing thread local access loggers is actually executed in each thread. In the previous implementation, the callback only captures the reference to the AccessLogConfig object owned by HttpGrpcAccessLog/TcpGrpcAccessLog which might not outlive, and therefore potentially this causes the invalid memory access and crashes the Envoy in any thread. This happens especially when an xDS resource is NACKed.
Related Issues: #18066

Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@repokitteh-read-only
Copy link
Copy Markdown

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: #18081 was opened by mathetake.

see: more, trace.

@mathetake mathetake marked this pull request as ready for review September 11, 2021 05:18
@mathetake mathetake requested a review from lizan September 11, 2021 05:21
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@jmarantz
Copy link
Copy Markdown
Contributor

/assign-from @envoyproxy/first-pass-reviewers

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/first-pass-reviewers assignee is @tonya11en

🐱

Caused by: a #18081 (comment) was created by @jmarantz.

see: more, trace.

lambdai
lambdai previously approved these changes Sep 13, 2021
Copy link
Copy Markdown
Contributor

@lambdai lambdai left a comment

Choose a reason for hiding this comment

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

Thanks! The tls lambda removes this and replaced by either value or the scope.

Unlike the config_ member, scope is the topic should be resolve separately as in the comment.

tonya11en
tonya11en previously approved these changes Sep 14, 2021
Copy link
Copy Markdown
Member

@tonya11en tonya11en left a comment

Choose a reason for hiding this comment

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

LGTM on first pass. Thanks for fixing!

@lizan
Copy link
Copy Markdown
Member

lizan commented Sep 16, 2021

Is it possible to have a test around this?

@mathetake
Copy link
Copy Markdown
Member Author

oh yeah will do!

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake mathetake dismissed stale reviews from tonya11en and lambdai via 5651819 September 17, 2021 02:27
@mathetake
Copy link
Copy Markdown
Member Author

mathetake@5651819 added

@lizan
Copy link
Copy Markdown
Member

lizan commented Sep 17, 2021

/assign-from @envoyproxy/maintainers
for non-tetrands review

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/maintainers assignee is @None

🐱

Caused by: a #18081 (comment) was created by @lizan.

see: more, trace.

@lizan
Copy link
Copy Markdown
Member

lizan commented Sep 17, 2021

/assign-from @envoyproxy/envoy-maintainers

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/envoy-maintainers assignee is @yanavlasov

🐱

Caused by: a #18081 (comment) was created by @lizan.

see: more, trace.

@yanavlasov yanavlasov merged commit d3412a9 into envoyproxy:main Sep 17, 2021
@mathetake mathetake deleted the access-logger-initialization- branch September 17, 2021 23:44
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.

6 participants