Skip to content

Conversation

@deng-jeffer
Copy link
Contributor

Purpose of the pull request

fix #17139

# 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
@deng-jeffer deng-jeffer requested a review from SbloodyS as a code owner April 17, 2025 07:04
@deng-jeffer deng-jeffer changed the title Fix log utils [Fix-17139][Common]fix rollViewLogLines IndexOutOfBoundsExceptionindex out of bounds exception [Fix-17139][Common]fix rollViewLogLines IndexOutOfBoundsExceptionindex out of bounds exception Apr 17, 2025
@deng-jeffer deng-jeffer changed the title [Fix-17139][Common]fix rollViewLogLines IndexOutOfBoundsExceptionindex out of bounds exception [Fix-17139][Common]fix rollViewLogLines IndexOutOfBoundsExceptionindex Apr 17, 2025
@nielifeng nielifeng requested a review from Copilot April 18, 2025 01:33
Copy link

Copilot AI left a 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;

Comment on lines 148 to 153
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.]")
Copy link

Copilot AI Apr 18, 2025

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.
@SbloodyS SbloodyS changed the title [Fix-17139][Common]fix rollViewLogLines IndexOutOfBoundsExceptionindex [Fix-17139][Common] Fix rollViewLogLines IndexOutOfBoundsExceptionindex Apr 18, 2025
…ler/common/utils/LogUtils.java

Co-authored-by: Copilot <[email protected]>
Copy link
Member

@ruanwenjun ruanwenjun left a 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.

@SbloodyS SbloodyS added the bug Something isn't working label May 1, 2025
@SbloodyS SbloodyS added this to the 3.3.1 milestone May 1, 2025
Copy link
Member

@SbloodyS SbloodyS left a 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

@apache apache deleted a comment from yashthattebito May 1, 2025
@apache apache deleted a comment from yashthattebito May 1, 2025
@deng-jeffer
Copy link
Contributor Author

Please fix CI errors. @deng-jeffer

done.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 2025

@SbloodyS SbloodyS removed this from the 3.3.1 milestone Aug 18, 2025
@SbloodyS SbloodyS closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working priority:low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [COMMON] LogUtils rollViewLogLines will be IndexOutOfBoundsException

3 participants