branch-4.1: [Fix](be) Prevent BE crash on malformed adapter responses #68247 - #68333
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
### 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.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #68247