hr342425 opened a new pull request, #13660:
URL: https://github.com/apache/skywalking/pull/13660
### Fix BanyanDB INVALID_ARGUMENT error when analyzing profile snapshots
- [ ] Add a unit test to verify that the fix works.
- [x] Explain briefly why the bug exists and how to fix it.
**Bug Description:**
When using BanyanDB as the storage backend and analyzing profile data via
the UI, the system throws an `INVALID_ARGUMENT` error:
```
org.apache.skywalking.banyandb.v1.client.grpc.exception.InvalidArgumentException:
io.grpc.StatusRuntimeException: INVALID_ARGUMENT: begin:{}
end:{seconds:9223372036854775 nanos:807000000}
is invalid: time is out of range -9223372036854775808 - 9223372036854775807
```
**Root Cause:**
In `ProfileAnalyzer.analyze()`, the Go profile fallback logic passes
`Long.MAX_VALUE` as the end time to `queryMinSequence()` and
`queryMaxSequence()`:
```java
int minSeq = getProfileThreadSnapshotQueryDAO().queryMinSequence(segId, 0L,
Long.MAX_VALUE);
int maxSeqExclusive =
getProfileThreadSnapshotQueryDAO().queryMaxSequence(segId, 0L, Long.MAX_VALUE)
+ 1;
```
While this works fine for JDBC storage backends,
`BanyanDBProfileThreadSnapshotQueryDAO` passes this value directly to
`TimestampRange`, which BanyanDB server cannot handle as it exceeds the
supported time range.
**Fix:**
Clamp the `start` and `end` time parameters in
`BanyanDBProfileThreadSnapshotQueryDAO.querySequenceWithAgg()` to safe bounds
using `LOWER_BOUND_TIME` and `UPPER_BOUND_TIME` constants already defined in
`AbstractBanyanDBDAO`.
```java
long safeStart = Math.max(start, LOWER_BOUND_TIME);
long safeEnd = Math.min(end, UPPER_BOUND_TIME);
```
- [ ] If this pull request closes/resolves/fixes an existing issue, replace
the issue number. Closes #<issue number>.
- [ ] Update the [`CHANGES`
log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
--
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]