delei opened a new pull request, #3642:
URL: https://github.com/apache/hertzbeat/pull/3642
## What's changed?
When monitoring historical data, if the collector encounters a timeout
exception, the following exception information is seen in the log file.
```bash
2025-08-07 22:13:45.307 [metrics-task-timeout-monitor-0] ERROR
org.apache.hertzbeat.collector.dispatch.CommonDispatcher Line:166 - [Collect
Timeout]:
org.apache.hertzbeat.common.entity.message.CollectRep$MetricsData@5eb8d171
2025-08-07 22:13:45.333 [540024518491648-dolphinscheduler-overview-5320]
ERROR org.apache.hertzbeat.collector.dispatch.WorkerPool Line:48 - [Important]
WorkerPool workerExecutor has uncaughtException.
java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 6
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4601)
at java.base/java.lang.String.substring(String.java:2704)
at
org.apache.hertzbeat.collector.dispatch.MetricsCollect.transformCal(MetricsCollect.java:425)
at
org.apache.hertzbeat.collector.dispatch.MetricsCollect.lambda$calculateFields$0(MetricsCollect.java:259)
at
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at
java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at
org.apache.hertzbeat.collector.dispatch.MetricsCollect.calculateFields(MetricsCollect.java:261)
at
org.apache.hertzbeat.collector.dispatch.MetricsCollect.run(MetricsCollect.java:223)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
```
I tracked this issue and fixed this potential
`StringIndexOutOfBoundsException`.
## Checklist
- [x] I have read the [Contributing
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
- [x] I have written the necessary doc or comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]