apache/seatunnel · warning · IOException

Failed to close Google Pub/Sub subscriber

Error message

Failed to close Google Pub/Sub subscriber

What it means

GooglePubSubSubscriber.close() shuts down the subscriber and optional emulator gRPC channel, aggregating exceptions via addSuppressed and throwing an IOException("Failed to close Google Pub/Sub subscriber") if any shutdown step failed. Unlike the others it is an IOException, not a connector exception.

Source

Thrown at seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/source/GooglePubSubSubscriber.java:181

                    if (failure == null) {
                        failure = timeout;
                    } else {
                        failure.addSuppressed(timeout);
                    }
                }
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                emulatorChannel.shutdownNow();
                if (failure == null) {
                    failure = e;
                } else {
                    failure.addSuppressed(e);
                }
            }
        }

        if (failure != null) {
            throw new IOException("Failed to close Google Pub/Sub subscriber", failure);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the suppressed exceptions for the real cause
  2. This usually masks a prior failure — check logs for the earlier subscriber error
  3. Safe to ignore in cleanup paths if the job is already failing; the task abort will handle it
  4. Avoid double-close; ensure close is called once per reader lifecycle
Defensive patterns

Strategy: try-catch

Try / catch

try { subscriber.close(); } catch (IOException e) { log.warn("close failed, suppressed: {}", Arrays.toString(e.getSuppressed())); }

Prevention

When it happens

Trigger: subscriber.stopAsync().awaitTerminated() throws (IllegalStateException because the subscriber was already failed), or channel shutdown throws while closing resources.

Common situations: Close called after an earlier subscriber failure (state already FAILED); interrupted during graceful shutdown; double-close in abnormal task teardown paths.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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