-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[Fix-17139][Common] Fix rollViewLogLines IndexOutOfBoundsExceptionindex #17140
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
base: dev
Are you sure you want to change the base?
[Fix-17139][Common] Fix rollViewLogLines IndexOutOfBoundsExceptionindex #17140
Conversation
# Conflicts: # dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/bin/jvm_args_env.sh # dolphinscheduler-api/src/main/bin/jvm_args_env.sh # dolphinscheduler-master/src/main/bin/jvm_args_env.sh # dolphinscheduler-standalone-server/src/main/bin/jvm_args_env.sh # dolphinscheduler-worker/src/main/bin/jvm_args_env.sh
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.
Pull Request Overview
This pull request addresses the IndexOutOfBoundsException in the rollViewLogLines method by modifying the way log line sizes are measured. The changes include replacing the byte-based size calculation with a character-based length measurement and updating related variable names and log messages.
Comments suppressed due to low confidence (1)
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LogUtils.java:145
- [nitpick] The variable name 'totalLogSize' may be ambiguous since it now counts characters instead of bytes. Consider renaming it to 'totalLogCharCount' or similar to clarify its purpose.
int totalLogSize = 0;
final int lineSize = line.length(); | ||
if (lineSize >= MaxResponseLogSize) { | ||
builder.append(line, 0, MaxResponseLogSize) | ||
.append(" [this line's size ").append(lineByteSize).append(" bytes is exceed ") | ||
.append(" [this line's size ").append(lineSize).append(" bytes is exceed ") | ||
.append(MaxResponseLogSize).append(" bytes, so only ") | ||
.append(MaxResponseLogSize).append(" characters are reserved for performance reasons.]") |
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.
Changing the size measurement from bytes to characters may lead to inaccurate log size calculations when non-ASCII characters are present. Consider retaining byte-based calculation or ensuring that the character-based approach meets the intended requirements.
Copilot uses AI. Check for mistakes.
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LogUtils.java
Outdated
Show resolved
Hide resolved
…ler/common/utils/LogUtils.java Co-authored-by: Copilot <[email protected]>
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.
LGTM, it's better to use a clearer naming.
MaxResponseLogSize
-> maxLogCharSize
totalLogSize
-> totalLogCharSize
And we may need to cut off of the log before write to log file if one line exceeds the max threshold, otherwise the worker might easilly OOM.
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LogUtils.java
Outdated
Show resolved
Hide resolved
…ler/common/utils/LogUtils.java Co-authored-by: Wenjun Ruan <[email protected]>
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.
Please fix CI errors. @deng-jeffer
done. |
|
Purpose of the pull request
fix #17139