Fix pipe drop stuck on blocking sink reconnect#18145
Open
Caideyipi wants to merge 1 commit into
Open
Conversation
f7b508e to
63c717d
Compare
jt2594838
reviewed
Jul 8, 2026
Comment on lines
+290
to
+294
| LOGGER.warn( | ||
| "Failed to discard events of pipe {} in connector subtask {}.", | ||
| committerKey.getPipeName(), | ||
| getDisplayTaskID(), | ||
| e); |
Comment on lines
+113
to
+128
| final Thread discardThread = | ||
| new Thread(() -> subtask.discardEventsOfPipe(new CommitterKey("pipe", 1L, 1, -1))); | ||
| discardThread.start(); | ||
| discardThread.join(1000); | ||
|
|
||
| try { | ||
| Assert.assertFalse(discardThread.isAlive()); | ||
| Assert.assertFalse(discardEntered.await(100, TimeUnit.MILLISECONDS)); | ||
| Assert.assertFalse(discardDuringHandshake.get()); | ||
| } finally { | ||
| releaseHandshake.countDown(); | ||
| failureThread.join(5000); | ||
| Assert.assertTrue(discardEntered.await(1, TimeUnit.SECONDS)); | ||
| Assert.assertFalse(discardDuringHandshake.get()); | ||
| subtask.close(); | ||
| } |
Contributor
There was a problem hiding this comment.
Fixed-wait may make the test unstable.
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.
Summary
This PR prevents
DROP PIPEfrom getting stuck when an external sink connector blocks during connection retry or close.Changes:
handshake()afterPipeConnectionException.transfer,heartbeat, retryhandshake,discardEventsOfPipe, andclose) with a connector-operation lock, so custom/internal connectors are not required to tolerate concurrent calls from drop/close paths.close()bounded by a timeout during drop.Positive effects
DROP PIPEis no longer blocked indefinitely by a sink connector stuck in external network operations such as MQTT/Paho connect or publish retry.handshake/close/discardcalls.Potential negative effects
close()itself starts and then blocks, drop proceeds after the timeout and the daemon close thread may remain alive until the connector returns.Tests
mvn spotless:apply -pl iotdb-core/node-commons,iotdb-core/datanodegit diff --check$env:MAVEN_OPTS='-Xmx768m'; mvn -pl iotdb-core/node-commons,iotdb-core/datanode -DskipTests "-Dcheckstyle.skip=true" "-Dspotless.check.skip=true" compile$env:MAVEN_OPTS='-Xmx768m'; mvn -pl iotdb-core/node-commons,iotdb-core/datanode -Dtest=PipeSinkSubtaskTest -DfailIfNoTests=false "-Dsurefire.failIfNoSpecifiedTests=false" "-Dcheckstyle.skip=true" "-Dspotless.check.skip=true" test