heguanhui opened a new pull request, #63922:
URL: https://github.com/apache/doris/pull/63922
### What problem does this PR solve?
Issue Number: close #63921
Related PR: #xxx
Problem Summary:
When `OrcReader::_init_orc_row_reader()` catches an exception from
`createRowReader` with `should_stop=true` and error message `"stop"`, it
swallows the exception and returns `Status::OK()`, leaving `_row_reader` as
nullptr. Subsequent calls to `_seek_to_read_one_line()` dereference the null
`_row_reader` via `_row_reader->seekToRow()`, causing SEGV.
This is inconsistent with `_create_file_reader()` which returns
`Status::EndOfFile("stop")` in the same `should_stop` scenario.
**ASAN crash stack:**
```
==XX==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000030
#0 orc::RowReaderImpl::seekToRow(unsigned long)
#1 doris::vectorized::OrcReader::_seek_to_read_one_line()
vorc_reader.h:710
#2 doris::vectorized::OrcReader::_get_next_block_impl()
vorc_reader.cpp:2350
```
**Root cause chain:**
1. `_init_orc_row_reader()` catch block: `should_stop` + `"stop"` → swallows
exception, returns `Status::OK()`, `_row_reader` remains nullptr
2. Caller sees `Status::OK()`, proceeds to call `get_next_block()`
3. `_get_next_block_impl()` → `_seek_to_read_one_line()` →
`_row_reader->seekToRow()` → SEGV
**Fix:**
1. `_init_orc_row_reader()` catch block: return `Status::EndOfFile("stop")`
instead of `Status::OK()`, consistent with `_create_file_reader()`
2. `_seek_to_read_one_line()`: change return type from `bool` to `Status`,
add `DORIS_CHECK(_row_reader)` assertion for precondition
3. `_get_next_block_impl()`: adapt to handle `Status` return from
`_seek_to_read_one_line()`, distinguish `END_OF_FILE` from other errors
4. Test: `EXPECT_TRUE` → `ASSERT_TRUE` to prevent continuing after init
failure
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [x] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]