Skip to content

Conversation

@hr342425
Copy link
Contributor

@hr342425 hr342425 commented Jan 12, 2026

Fix BanyanDB INVALID_ARGUMENT error when analyzing profile snapshots

  • Add a unit test to verify that the fix works.
  • 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():

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.

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 #.
  • Update the CHANGES log.

… query

Clamp time range bounds to LOWER_BOUND_TIME/UPPER_BOUND_TIME to avoid
BanyanDB INVALID_ARGUMENT error when Long.MAX_VALUE is passed from
ProfileAnalyzer's Go profile fallback logic.
@wu-sheng wu-sheng requested a review from wankai123 January 12, 2026 09:35
wankai123
wankai123 previously approved these changes Jan 12, 2026
@wu-sheng wu-sheng added the bug Something isn't working and you are sure it's a bug! label Jan 13, 2026
@wu-sheng
Copy link
Member

@hr342425 Could you update the changes.md by following PR template?

@wu-sheng wu-sheng added this to the 10.4.0 milestone Jan 13, 2026
@wu-sheng wu-sheng added the backend OAP backend related. label Jan 13, 2026
@hr342425
Copy link
Contributor Author

Done. I've updated the changes.md. @wu-sheng

@wu-sheng
Copy link
Member

Done. I've updated the changes.md. @wu-sheng

We are working on CI pipeline fixing. The failing ones should not be caused by your changes.

@wu-sheng wu-sheng merged commit 4495f3c into apache:master Jan 13, 2026
347 of 351 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend OAP backend related. bug Something isn't working and you are sure it's a bug!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants