apache/seatunnel · error · IotdbConnectorException

IotdbConnectorErrorCode.CLOSE_SESSION_FAILED

IotdbConnectorErrorCode.CLOSE_SESSION_FAILED

Error message

Close IoTDB session failed

What it means

IoTDBSourceReader.close() failed to close the IoTDB session cleanly, throwing IotdbConnectorException(CLOSE_SESSION_FAILED). The reader is shutting down (task stop/close) and the session.close() call raised IoTDBConnectionException, usually because the connection to the server is already gone.

Source

Thrown at seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/source/IoTDBSourceReader.java:94

        this.context = readerContext;
        this.deserializer = new DefaultSeaTunnelRowDeserializer(rowType);
    }

    @Override
    public void open() throws IoTDBConnectionException {
        session = buildSession(conf);
        session.open();
    }

    @Override
    public void close() throws IOException {
        // nothing to do
        try {
            if (session != null) {
                session.close();
            }
        } catch (IoTDBConnectionException e) {
            throw new IotdbConnectorException(
                    IotdbConnectorErrorCode.CLOSE_SESSION_FAILED, "Close IoTDB session failed", e);
        }
    }

    @Override
    public void pollNext(Collector<SeaTunnelRow> output) throws Exception {
        while (!pendingSplits.isEmpty()) {
            synchronized (output.getCheckpointLock()) {
                IoTDBSourceSplit split = pendingSplits.poll();
                read(split, output);
            }
        }

        if (Boundedness.BOUNDED.equals(context.getBoundedness())
                && noMoreSplitsAssignment
                && pendingSplits.isEmpty()) {
            // signal to the source that we have reached the end of the data.
            log.info("Closed the bounded iotdb source");

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify IoTDB is reachable; if the server is already down this error is usually harmless at teardown — inspect logs for other failures.
  2. Ensure the reader doesn't outlive the IoTDB session's idle timeout; tune server-side session timeouts.
  3. Check for double-close of the reader/session in custom code.
  4. If persistent, review IoTDB client/driver version compatibility.
Defensive patterns

Strategy: try-catch

Try / catch

try { reader.close(); } catch (IotdbConnectorException e) { log.warn("IoTDB session close failed during teardown; ignoring", e); }

Prevention

When it happens

Trigger: session.close() throws IoTDBConnectionException during reader close — server unreachable, connection already closed/timed out, or network interrupted at shutdown.

Common situations: IoTDB restarted or killed before the SeaTunnel task closed; network partition during job teardown; session idle timeout on the server side; closing after a prior connection failure.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/2c6209dbc185010a. Report an issue: GitHub.