apache/seatunnel · error · IOException
Failed to close Google Pub/Sub publisher
Error message
Failed to close Google Pub/Sub publisher
What it means
Thrown from GooglePubSubPublisher.close when one or more exceptions occur while shutting down / flushing the underlying Pub/Sub Publisher (e.g. publisher.shutdown() awaits termination and fails, or shutdownAsync callbacks throw). All secondary exceptions are collected via addSuppressed and the first is thrown as an IOException.
Source
Thrown at seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/sink/GooglePubSubPublisher.java:141
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 publisher", failure);
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Check the suppressed exceptions in the stack trace to find the root failure (timeout vs I/O).
- Ensure network connectivity to Pub/Sub before job shutdown so in-flight messages can be flushed.
- Tune outstanding-message/byte limits downward so shutdown has fewer in-flight messages to flush.
- Verify the publisher is only closed once and that the sink lifecycle (open/close) is respected by the engine.
Defensive patterns
Strategy: try-catch
Try / catch
try {
publisher.close();
} catch (IOException e) {
logger.warn("Publisher close failed; {} suppressed exceptions", e.getSuppressed().length, e);
// in-flight messages were likely lost; rely on Pub/Sub redelivery downstream
} Prevention
- Drain or stop producing before shutdown so fewer messages are in flight.
- Keep outstanding-message/byte limits modest to shorten flush time.
- Ensure network is healthy at job shutdown.
When it happens
Trigger: Calling close() on the publisher (writer/sink close, task cancellation, job shutdown) while the underlying Publisher fails to terminate cleanly: publication still in flight that cannot be delivered, shutdown timeout elapsing, or the gRPC channel being already broken.
Common situations: Killing a job with unflushed messages during network outage; overly short shutdown grace period causing timeout; emulator channel abruptly terminated; repeated close calls on a broken channel.
Related errors
- Stream closed
- Option 'field_delimiter' cannot be empty
- Option '${option}' cannot be blank
- Option '${option}' must be greater than 0
- CONNECTION_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/20f6bb52eb91468f.
Report an issue: GitHub.