Skip to content

[bug](avro) fix avro jni reader coredump with nullptr - #64699

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
zhangstar333:avo_timezone
Jun 23, 2026
Merged

yiguolei merged 1 commit into
apache:branch-4.1from
zhangstar333:avo_timezone

Conversation

@zhangstar333

@zhangstar333 zhangstar333 commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Problem Summary:
when fetch_table_schema call by FE rpc, will not pass runtime state object, so it's nullptr.
master branch have been refactor so it's no problem.

 1# PosixSignals::chained_handler(int, siginfo_t*, void*) [clone .part.0] at src/hotspot/os/posix/signals_posix.cpp:454
 2# JVM_handle_linux_signal at src/hotspot/os/posix/signals_posix.cpp:641
 3# 0x00007F93C27AB520 in /lib/x86_64-linux-gnu/libc.so.6
 4# _ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_EC2IRA10_KcRS6_Qaacl16_S_constructibleITL0__TL0_0_EEntcl10_S_danglesISD_SE_EEEEOT_OT0_ 
at /root/tools/ldb-toolchain/bin/../lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_pair.h:464
 5# std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_stri
ng<char, std::char_traits<char>, std::allocator<char> > > >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
 >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic
_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
 std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_tr
aits<char>, std::allocator<char> > > > >::_M_emplace_unique<char const (&) [10], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
 > const&>(char const (&) [10], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at /root/tools/ldb-toolchain/bin/../li
b/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_tree.h:3056
 6# doris::vectorized::JniConnector::open(doris::RuntimeState*, doris::RuntimeProfile*) at /root/selectdb-core/be/src/vec/exec/jni_connector.cpp:98
 7# doris::vectorized::AvroJNIReader::init_schema_reader() at /root/selectdb-core/be/src/vec/exec/format/avro/avro_jni_reader.cpp:123
 8# std::_Function_handler<void (), doris::PInternalService::fetch_table_schema(google::protobuf::RpcController*, doris::PFetchTableSchemaRequest const*, dori

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • 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.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@zhangstar333
zhangstar333 requested a review from yiguolei as a code owner June 22, 2026 11:11
@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?

@zhangstar333

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits or try again at 11:44 AM.
Workflow run: https://github.com/apache/doris/actions/runs/27948545316

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@zhangstar333

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review completed for PR 64699.

Summary opinion: I found no substantiated blocking issue in this PR. The patch only guards insertion of time_zone in JniConnector::open() when RuntimeState* is null. The null-state path is the Avro schema-only reader, whose constructor sets _is_table_schema; Java Avro schema parsing does not consume time_zone, and normal scan paths still call open(_state, _profile) with a non-null state.

Critical checkpoints:

  • Changed files: GitHub and local diff both report only be/src/exec/connector/jni_connector.cpp.
  • Existing review context: no existing inline review comments or replies were present.
  • Duplicate suppression: no prior inline thread or ledger candidate covered an issue requiring suppression.
  • Correctness: no evidence of changed scan semantics outside the null-state Avro schema-fetch crash path.
  • Session/config propagation: normal JNI scan paths still receive time_zone; schema-only Avro parsing does not require it.
  • Tests/style: git diff --check on the changed file passed. I did not run a full build or regression suite because the patch is a narrow null guard.

Subagent conclusions:

  • optimizer-rewrite: no candidate found; convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • tests-session-config: no candidate found; convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • No subagent candidates became inline comments, and none were dismissed as duplicates. Main dismissals are recorded in .code-review.r4svrC/subagent_review_findings.md.

User focus: no additional user-provided review focus was supplied.

Review instruction note: no repository-local SKILL.md code-review skill was present in this checkout, so the review followed the supplied .code-review.r4svrC/review_prompt.txt instructions and repository evidence.

@zhangstar333

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 0.00% (0/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 72.04% (26812/37220)
Line Coverage 55.12% (285656/518219)
Region Coverage 52.67% (238946/453680)
Branch Coverage 53.76% (102972/191534)

@yiguolei
yiguolei merged commit 1835b8b into apache:branch-4.1 Jun 23, 2026
30 of 33 checks passed
@yiguolei yiguolei mentioned this pull request Jul 7, 2026
morningman added a commit that referenced this pull request Oct 31, 2026
…69849)

### What problem does this PR solve?

Issue Number: None

Related PR: #69601, #64699

Problem Summary:

**In short.** #69601 made FE reject `format=avro` while it parses file
format properties. This PR adds end-to-end coverage for that: a
regression suite that runs `s3()` and `hdfs()` with `format=avro` and
checks that they fail during analysis, and a unit test for the two
table-function constructors. Test only, no code change.

**Background.** Master no longer reads standalone Avro files: #61141
removed the BE reader, #65733 the scanner module, and #69601 made
`FileFormatProperties.createFileFormatProperties` throw `Avro file reads
are no longer supported`. Before #69601, FE accepted the format and the
query failed later in BE with `Not supported file format in fetch table
schema: 12`. branch-4.2 still reads Avro through the JNI scanner (#64699
fixed a crash in it), so users who upgrade from 4.x with Avro table
functions or loads get this error.

**What was missing.** #69601's unit test calls
`createFileFormatProperties` directly. Nothing checks that a table
function reaches that check before it validates storage properties or
lists files. If a constructor validated the location first,
`format=avro` against an unreachable location would report a storage
error instead, and no test would notice.

**What this PR adds.**

- `external_table_p0/tvf/test_tvf_avro_format_rejected`: `s3()` and
`hdfs()` with `format` set to `avro` and to `AVRO`, against a made-up
bucket, made-up credentials and an HDFS address nothing listens on. Each
call must fail with `Avro file reads are no longer supported`.
-
`UnsupportedExternalReadsTest#testAvroTableFunctionsAreRejectedBeforeStorageAccess`:
constructs `S3TableValuedFunction` and `HdfsTableValuedFunction` with
`format=avro` / `AVRO` and checks the same message.

**Results.** On master `2a4191c1dc9` with this change, all four
statements of the suite fail during analysis with `Can not build s3():
Avro file reads are no longer supported` / `Can not build hdfs(): ...`,
and the unit test passes. Before #69601 the same `s3()` call would have
gone on to validate and list the made-up location, so the suite pins the
order as well as the message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants