Skip to content

[bug](jdbc) test_jdbc_connection rpc should check enable_java_support firstly#62486

Open
zhangstar333 wants to merge 1 commit intoapache:masterfrom
zhangstar333:jdbc_test_conn2
Open

[bug](jdbc) test_jdbc_connection rpc should check enable_java_support firstly#62486
zhangstar333 wants to merge 1 commit intoapache:masterfrom
zhangstar333:jdbc_test_conn2

Conversation

@zhangstar333
Copy link
Copy Markdown
Contributor

@zhangstar333 zhangstar333 commented Apr 14, 2026

What problem does this PR solve?

Problem Summary:
if enable_java_support=false, and the rpc of test_jdbc_connection may cause coredump

*** Query id: 0-0 ***
*** tablet id: 0 ***
*** Aborted at 1776056623 (unix time) try "date -d @1776056623" if you are using GNU date ***
*** Current BE git commitID: 000395ded91 ***
*** SIGSEGV address not mapped to object (@0x10) received by PID 3520046 (TID 3524680 OR 0x10cc164ee640) from PID 16; stack trace: ***
 0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, siginfo_t*, void*) at ../src/common/signal_handler.h:417
 1# PosixSignals::chained_handler(int, siginfo*, void*) in /mnt/disk6/common/jdk-17.0.16/lib/server/libjvm.so
 2# JVM_handle_linux_signal in /mnt/disk6/common/jdk-17.0.16/lib/server/libjvm.so
 3# 0x000014D80A03E6F0 in /lib64/libc.so.6
 4# setTLSExceptionStrings at /home/runner/work/doris-thirdparty/doris-thirdparty/thirdparty/src/doris-thirdparty-hadoop-3.4.2.2-for-doris/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:908
 5# printExceptionAndFreeV at /home/runner/work/doris-thirdparty/doris-thirdparty/thirdparty/src/doris-thirdparty-hadoop-3.4.2.2-for-doris/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c:196
 6# printExceptionAndFree at /home/runner/work/doris-thirdparty/doris-thirdparty/thirdparty/src/doris-thirdparty-hadoop-3.4.2.2-for-doris/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c:226
 7# getJNIEnv at /home/runner/work/doris-thirdparty/doris-thirdparty/thirdparty/src/doris-thirdparty-hadoop-3.4.2.2-for-doris/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/jni_helper.c:824
 8# doris::Jni::Env::GetJNIEnvSlowPath(JNIEnv_**) at ./be/build_ASAN/../src/util/jni-util.cpp:182
 9# doris::Jni::Env::Get(JNIEnv_**) at ../src/util/jni-util.h:57
10# doris::JniReader::open(doris::RuntimeState*, doris::RuntimeProfile*) at ./be/build_ASAN/../src/format/jni/jni_reader.cpp:97
11# doris::PInternalService::test_jdbc_connection(google::protobuf::RpcController*, doris::PJdbcTestConnectionRequest const*, doris::PJdbcTestConnectionResult*, google::protobuf::Closure*)::$_0::operator()() const at ./be/build_ASAN/../src/service/internal_service.cpp:1084 

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
Copy link
Copy Markdown
Contributor Author

/review

@zhangstar333
Copy link
Copy Markdown
Contributor Author

run buildall

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found in this change.

Critical checkpoints:

  • Goal / correctness: The goal is to prevent test_jdbc_connection from entering the JNI path when enable_java_support=false. The new early return in be/src/service/internal_service.cpp does that before the request is queued or JniReader::open() can call Jni::Env::Get(), so it addresses the reported crash. FE already converts non-OK PStatus from this RPC into a user-facing error.
  • Scope / minimality: The modification is small, focused, and limited to the affected RPC entry point.
  • Concurrency: No new concurrency is introduced. The handler now either fails fast on the RPC thread or follows the existing heavy-work-pool path unchanged. No shared-state or lock behavior changes.
  • Lifecycle / static initialization: No lifecycle or static-init risk is added. The guard actually reduces exposure to JVM/TLS initialization paths when Java support is disabled.
  • Configuration: No new config is added. The change correctly follows the existing enable_java_support contract and restart requirement.
  • Compatibility: No FE/BE protocol, symbol, storage-format, or rolling-upgrade compatibility issue is introduced.
  • Parallel code paths: Existing HDFS/JNI entry points already guard on enable_java_support; this brings test_jdbc_connection in line with those paths.
  • Conditional check quality: The new condition is justified and straightforward because BE only initializes JNI when Java support is enabled in doris_main.cpp.
  • Test coverage: No automated test was added for this crash path. That is the main residual risk, but given the very localized fix and the direct alignment with existing guard patterns, I do not see it as a blocker.
  • Test results changed: Not applicable.
  • Observability: Existing status propagation is sufficient for this path; no additional logging/metrics appear necessary.
  • Transaction / persistence / data-write impact: Not applicable.
  • FE-BE variable passing: Not applicable.
  • Performance: Slightly improved in the disabled-Java case by failing before queueing, thrift deserialization, and JNI setup.
  • Other issues: None found.

Summary opinion: The fix is correct, minimal, and consistent with adjacent JNI/HDFS guard patterns. The only notable gap is missing automated coverage for this RPC failure path.

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/7) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.06% (20148/37969)
Line Coverage 36.61% (189502/517687)
Region Coverage 32.83% (146964/447719)
Branch Coverage 33.99% (64391/189423)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 14.29% (1/7) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.63% (27379/37183)
Line Coverage 57.28% (295604/516103)
Region Coverage 54.42% (245918/451851)
Branch Coverage 56.13% (106658/190005)

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