{"record":{"id":"20f6bb52eb91468f","repo":"apache/seatunnel","slug":"failed-to-close-google-pub-sub-publisher","errorCode":null,"errorMessage":"Failed to close Google Pub/Sub publisher","messagePattern":"Failed to close Google Pub/Sub publisher","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/sink/GooglePubSubPublisher.java","lineNumber":141,"sourceCode":"                    if (failure == null) {\n                        failure = timeout;\n                    } else {\n                        failure.addSuppressed(timeout);\n                    }\n                }\n            } catch (InterruptedException e) {\n                Thread.currentThread().interrupt();\n                emulatorChannel.shutdownNow();\n                if (failure == null) {\n                    failure = e;\n                } else {\n                    failure.addSuppressed(e);\n                }\n            }\n        }\n\n        if (failure != null) {\n            throw new IOException(\"Failed to close Google Pub/Sub publisher\", failure);\n        }\n    }\n}\n","sourceCodeStart":123,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/sink/GooglePubSubPublisher.java#L123-L145","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    publisher.close();\n} catch (IOException e) {\n    logger.warn(\"Publisher close failed; {} suppressed exceptions\", e.getSuppressed().length, e);\n    // in-flight messages were likely lost; rely on Pub/Sub redelivery downstream\n}","preventionTips":["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."],"tags":["google-pubsub","shutdown","io","java"],"backgroundTag":"resource-close-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}