Repository navigation
[fix][functions] Fix Java Function instance LogAppender missing logs - #17471
Merged
Merged
Conversation
Contributor
|
@merlimat @codelipenghui @Technoboy- @cbornet @lhotari I think that it is safer to revert #15188 at least for Pulsar 2.11 I agree with this patch but we have to fix 2.11 as priority |
eolivelli
requested review from
Technoboy-,
codelipenghui,
lhotari and
merlimat
September 5, 2022 09:40
1 of 5 tasks
The logs are sent asynchronously to the appender using AsyncLoggerContextSelector. So there's a possibility that we remove the appender before we get in the LogAppender processing. This change activates the LogAppender once and for all. Fix apache#15392
cbornet
force-pushed
the
fix-log-topic
branch
from
September 6, 2022 00:04
f7e01b9 to
2a07cb4
Compare
nicoloboschi
approved these changes
Sep 6, 2022
Technoboy-
approved these changes
Sep 7, 2022
codelipenghui
approved these changes
Sep 8, 2022
Member
|
Cool! |
Technoboy-
pushed a commit
that referenced
this pull request
Sep 13, 2022
Contributor
Contributor
Author
|
Yes, I think we can add it again. |
4 of 11 tasks
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.
Fixes #15392
Motivation
When using a
log-topicin Functions, an appender is added to all loggers to send the logs with the Pulsar client.To prevent sending logs from the framework, the
LogAppenderis added before the function processing (JavaInstance::handleMessage) and removed just after.This is a problem because since #15188, the logs are sent asynchronously and sometimes we remove the appender before the log is processed by the
LogAppender.And this is the reason why we see flakyness in
testJavaLoggingFunctionbecause me miss some logs.This is also a problem when using an async Function that returns
CompletableFuturewhere the execution of the Function will be done async and probably when the appender is removed.I had a look and the framework only sends error logs. It may even be interesting to get these logs to debug Functions.
So this change is about removing this dynamic add/delete of the appender (which probably also has some effect on perf) and add it once and for all.
Modifications
Remove calls to
addLogTopicHandlerandremoveLogTopicHandlerand callsetupLogTopicAppenderduring the setup.Verifying this change
This change is already covered by existing tests, such as testJavaLoggingFunction.
Does this pull request potentially affect one of the following parts:
no
If
yeswas chosen, please highlight the changesDocumentation
Check the box below or label this PR directly.
Need to update docs?
doc-required(Your PR needs to update docs and you will update later)
doc-not-neededfix
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)