FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add TLS channel failure reporting hooks by HTHou · Pull Request #18299 · apache/iotdb · GitHub

/ iotdb Public

Add TLS channel failure reporting hooks - #18299

Merged
HTHou merged 9 commits into
masterfrom
codex/trusted-channel-failure-hooks
Aug 24, 2026
Merged

Add TLS channel failure reporting hooks#18299
HTHou merged 9 commits into
masterfrom
codex/trusted-channel-failure-hooks

Conversation

HTHou commented Jul 24, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Description

This PR adds server-side internal hooks for reporting SSL/TLS channel setup failures together with the remote and local socket endpoints. It does not add or expose a new logging or persistence surface.

Failure context

  • Add a shared failure callback that propagates the original exception and both channel endpoints.
  • Generalize the existing session-specific failure event name for use across transport types.
  • Recognize SSL failures through the exception cause chain while preserving the original connection failure behavior.
  • Isolate reporting callback failures so they do not replace the transport exception.

Transport coverage

  • Report inbound TLS handshake failures for ConfigNode RPC, DataNode internal RPC, MPP exchange, IoTConsensus V1/V2, and the Session/JDBC-facing RPC service.
  • Report Jetty HTTPS handshake failures for the REST service.
  • Keep plaintext paths unchanged and use no-op callbacks when failure reporting is not configured.
  • Outbound client transports, the AINode TLS server, and Ratis gRPC are outside the scope of this change.

Validation

  • mvn test -pl iotdb-core/node-commons -Dtest=AbstractAuditLoggerTest,TrustedChannelAuditServerEventHandlerTest
  • mvn test -pl external-service-impl/rest -am -Dtest=TrustedChannelAuditHandshakeListenerTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false
  • mvn test-compile -DskipTests -pl external-service-impl/rest -am
  • mvn test-compile -P with-zh-locale -DskipTests -pl external-service-impl/rest -am
  • mvn dependency:analyze-only -pl external-service-impl/rest -DskipTests
  • Spotless, Checkstyle, and git diff --check

This PR has:

  • been self-reviewed.
  • added Javadocs for the shared callback and server-side handler.
  • added unit tests for the new failure-reporting paths.

Key changed/added classes
  • AbstractAuditLogger
  • TrustedChannelFailureHandler
  • TrustedChannelAuditServerEventHandler
  • TrustedChannelAuditHandshakeListener
  • ConsensusConfig
  • ConfigNode/DataNode server-side RPC entry points

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

This PR adds internal (non-user-facing) hooks to report SSL/TLS channel setup failures with both initiator and target endpoints, integrating the reporting into existing audit logging and wiring it through key outbound/inbound transport entry points (Thrift RPC, MPP exchange, consensus RPC, and REST over Jetty HTTPS).

Changes:

  • Introduces a shared TrustedChannelFailureHandler callback and AbstractAuditLogger helpers to detect SSL failures (via cause chain) and emit a trusted-channel failure audit record.
  • Adds server-side TLS handshake probing/reporting via TrustedChannelAuditServerEventHandler for Thrift services and a Jetty SslHandshakeListener implementation for REST HTTPS.
  • Wires failure reporting into multiple outbound request paths (clients/dispatchers/handlers) and consensus configuration, plus adds unit tests and i18n message constants.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pom.xml Adds Jetty jetty-io to dependency management for HTTPS handshake listener support.
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/service/TrustedChannelAuditServerEventHandlerTest.java Unit tests for server-side Thrift TLS handshake reporting behavior.
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/audit/AbstractAuditLoggerTest.java Unit tests for SSL failure detection and trusted-channel audit recording.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/TrustedChannelAuditServerEventHandler.java Server-side Thrift event handler to force handshake and report failures with endpoints.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/client/request/AsyncRequestManager.java Adds an extensibility hook (onRequestFailure) for request-failure reporting.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/TrustedChannelFailureHandler.java New shared callback interface for trusted-channel failure reporting.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/AuditEventType.java Replaces the prior session-specific encrypt failure event with a generalized trusted-channel event.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/audit/AbstractAuditLogger.java Adds SSL-failure detection and a trusted-channel failure audit log emission path (with i18n).
iotdb-core/node-commons/src/main/i18n/zh/org/apache/iotdb/commons/i18n/CommonMessages.java Adds zh i18n template for the trusted-channel failure audit log message.
iotdb-core/node-commons/src/main/i18n/en/org/apache/iotdb/commons/i18n/CommonMessages.java Adds en i18n template for the trusted-channel failure audit log message.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/ExternalRPCService.java Wraps external RPC service handler with the trusted-channel server-side audit handler.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java Wraps internal RPC service handler with the trusted-channel server-side audit handler.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/FragmentInstanceDispatcherImpl.java Records trusted-channel failures on dispatch exceptions to remote nodes.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncSendPlanNodeHandler.java Records trusted-channel failures on async plan-node send errors (captures target endpoint).
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncPlanNodeSender.java Passes target endpoint into the async send handler for accurate failure reporting.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/source/SourceHandle.java Records trusted-channel failures on MPP source exchange RPC errors.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/sink/SinkChannel.java Records trusted-channel failures on MPP sink exchange RPC errors.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/exchange/MPPDataExchangeService.java Wraps MPP exchange service handler with the trusted-channel server-side audit handler.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/dn/AsyncTSStatusRPCHandler.java Records trusted-channel failures on async TSStatus RPC failures.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java Records trusted-channel failures when connecting/retrying ConfigNode RPC calls.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/an/AINodeClient.java Records trusted-channel failures when connecting/retrying AINode RPC calls.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java Plumbs trusted-channel failure handler into consensus config creation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/DNAuditLogger.java Adds a DataNode-side convenience overload to record failures with inferred local endpoint.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/service/IoTConsensusV2RPCService.java Wraps IoTConsensusV2 RPC handler with trusted-channel server-side audit handler; accepts callback.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/IoTConsensusV2.java Passes trusted-channel failure handler into IoTConsensusV2 RPC service construction.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCService.java Wraps IoTConsensus RPC handler with trusted-channel server-side audit handler; accepts callback.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java Passes trusted-channel failure handler into IoTConsensus RPC service construction.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/ConsensusConfig.java Adds trusted-channel failure handler to consensus config with NO_OP default and builder setter.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCService.java Wraps ConfigNode RPC handler with trusted-channel server-side audit handler.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java Records trusted-channel failures during ConfigNode→DataNode sync request retries.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java Hooks async request failures to ConfigNode audit logger via the new onRequestFailure extension point.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeHeartbeatClientPool.java Records trusted-channel failures during async heartbeat dispatch failures.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/audit/CNAuditLogger.java Adds a ConfigNode-side convenience overload to record failures with inferred local endpoint.
external-service-impl/rest/src/test/java/org/apache/iotdb/rest/TrustedChannelAuditHandshakeListenerTest.java Unit test for capturing endpoints on Jetty HTTPS handshake failures.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/TrustedChannelAuditHandshakeListener.java Jetty SslHandshakeListener implementation to report TLS handshake failures with endpoints.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java Installs the Jetty handshake listener for REST HTTPS connector TLS failures.
external-service-impl/rest/pom.xml Adds Jetty jetty-io dependency required by the handshake listener types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

codecov Bot commented Jul 24, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.62162% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.01%. Comparing base (ada62cb) to head (37c9a6f).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
...service/TrustedChannelAuditServerEventHandler.java 75.00% 14 Missing ⚠️
...tdb/rest/TrustedChannelAuditHandshakeListener.java 69.56% 7 Missing ⚠️
...rg/apache/iotdb/db/service/ExternalRPCService.java 0.00% 5 Missing ⚠️
...nsensus/pipe/service/IoTConsensusV2RPCService.java 0.00% 4 Missing ⚠️
...c/main/java/org/apache/iotdb/rest/RestService.java 0.00% 2 Missing ⚠️
...onfignode/service/thrift/ConfigNodeRPCService.java 0.00% 2 Missing ⚠️
.../consensus/iot/service/IoTConsensusRPCService.java 50.00% 2 Missing ⚠️
...rg/apache/iotdb/consensus/pipe/IoTConsensusV2.java 0.00% 2 Missing ⚠️
...ine/execution/exchange/MPPDataExchangeService.java 0.00% 2 Missing ⚠️
...e/iotdb/db/service/DataNodeInternalRPCService.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18299      +/-   ##
============================================
+ Coverage     43.95%   44.01%   +0.06%     
- Complexity      374      377       +3     
============================================
  Files          5402     5405       +3     
  Lines        388198   388748     +550     
  Branches      50694    50795     +101     
============================================
+ Hits         170633   171117     +484     
- Misses       217565   217631      +66     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 5 comments.

Copy link
Copy Markdown

Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

HTHou added 3 commits August 3, 2026 15:58
…el-failure-hooks

# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/DNAuditLogger.java
…el-failure-hooks

# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/DNAuditLogger.java
HTHou marked this pull request as ready for review August 24, 2026 04:12
HTHou requested a lite review from Copilot August 24, 2026 04:16
Copilot stopped reviewing on behalf of HTHou due to an error August 24, 2026 04:36
HTHou requested a balanced review from Copilot and removed request for Copilot August 24, 2026 07:07

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

HTHou requested a balanced review from Copilot August 24, 2026 07:30

Copilot AI 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown

Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

HTHou merged commit 83f6303 into master Aug 24, 2026
62 of 65 checks passed
HTHou deleted the codex/trusted-channel-failure-hooks branch August 24, 2026 12:34
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL