Skip to content

branch-4.1: [Fix](be) Prevent BE crash on malformed adapter responses #68247 - #68333

Open
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-68247-branch-4.1
Open

github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-68247-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #68247

### What problem does this PR solve?

Issue Number: N/A

Related PR: #68247

Problem Summary: AI adapters can receive valid JSON with unexpected nested value types, such as a numeric choice, a non-array embedding, or a string inside an embedding array. Calling RapidJSON object, array, or numeric accessors on those values can trigger assertions or invalid accesses in the BE. Validate each required type before accessing it, and share embedding-array validation and conversion across provider adapters. Malformed responses return a non-OK Status that callers propagate as a query error.

### Release note

Return query errors for malformed AI provider response types instead of risking a BE crash during response parsing.

### Check List (For Author)

- Test: Unit Test / Manual test
    - Add 21 malformed-response unit tests; BE UT and regression CI passed for e004a81.
    - Isolated parser comparison with ASAN/UBSAN: all 21 malformed examples return errors after the fix, and 25 normal examples produce unchanged results. This comparison does not run the full Doris engine.
- Behavior changed: Yes. Invalid response types return errors before invoking incompatible RapidJSON accessors.
- Does this need documentation: No.
@github-actions
github-actions Bot requested a review from yiguolei as a code owner September 21, 2026 09:42
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants