{"record":{"id":"4751d523f3f3bbd3","repo":"pinpoint-apm/pinpoint","slug":"reporter-close-fail","errorCode":null,"errorMessage":"reporter close fail","messagePattern":"reporter close fail","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/GrpcModuleLifeCycle.java","lineNumber":124,"sourceCode":"    @Override\n    public void shutdown() {\n        logger.info(\"shutdown()\");\n        IOUtils.closeQuietly(spanDataSender, (ex) -> logger.warn(\"spanDataSender close fail\", ex));\n        IOUtils.closeQuietly(statDataSender, (ex) -> logger.warn(\"statDataSender close fail\", ex));\n        IOUtils.closeQuietly(agentDataSender, (ex) -> logger.warn(\"agentDataSender close fail\", ex));\n        IOUtils.closeQuietly(metadataDataSender, (ex) -> logger.warn(\"metadataDataSender close fail\", ex));\n\n        if (dnsExecutorService != null) {\n            if (!MoreExecutors.shutdownAndAwaitTermination(dnsExecutorService, Duration.ofSeconds(3))) {\n                logger.warn(\"dnsExecutor shutdown failed\");\n            }\n        }\n        if (reconnectScheduledExecutorService != null) {\n            if (!MoreExecutors.shutdownAndAwaitTermination(reconnectScheduledExecutorService, Duration.ofSeconds(3))) {\n                logger.warn(\"reconnectScheduledExecutor shutdown failed\");\n            }\n        }\n        IOUtils.closeQuietly(reporter, (ex) -> logger.warn(\"reporter close fail\", ex));\n    }\n\n    @Override\n    public String toString() {\n        return \"GrpcModuleLifeCycle{\" +\n                \", agentDataSender=\" + agentDataSender +\n                \", metadataDataSender=\" + metadataDataSender +\n                \", spanDataSender=\" + spanDataSender +\n                \", statDataSender=\" + statDataSender +\n                \", dnsExecutorService=\" + dnsExecutorService +\n                \", reconnectScheduledExecutorService=\" + reconnectScheduledExecutorService +\n                '}';\n    }\n}\n","sourceCodeStart":106,"sourceCodeEnd":139,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/module/GrpcModuleLifeCycle.java#L106-L139","documentation":"The last step of GrpcModuleLifeCycle.shutdown() closes the aggregated reporter via IOUtils.closeQuietly(reporter, ...). If reporter.close() throws (flush of buffered spans/stats/metadata to the gRPC senders fails), the callback logs \"reporter close fail\". It indicates some buffered telemetry may be lost at shutdown, but the agent still terminates.","triggerScenarios":"shutdown() invoked while the reporter holds unflushed data and a sender close or flush fails — e.g. gRPC channel already closed/broken, or shutdown racing an in-flight flush.","commonSituations":"Agent shutdown during collector outage (flush fails on broken channel); closing the module twice; OOM or thread-pool exhaustion preventing the flush from completing; rapid start/stop cycles in tests.","solutions":["Inspect the cause logged under this warning; fix the underlying sender/channel issue (network, collector address).","Allow the agent a graceful stop window so in-flight spans can flush before JVM exit.","Avoid double-invoking shutdown() on the same module lifecycle.","If data loss at shutdown is unacceptable, keep the collector reachable and consider graceful JVM shutdown hooks with delay."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    lifeCycle.shutdown();\n} catch (Exception e) {\n    logger.warn(\"reporter close issue during profiler shutdown\", e);\n}","preventionTips":["Allow a graceful stop window so the reporter can flush buffered data.","Do not invoke shutdown() twice on the same lifecycle.","Keep the collector reachable until after shutdown completes.","Read the cause under the warning to identify the failing sender."],"tags":["grpc","shutdown","reporter","flush","network"],"backgroundTag":"resource-cleanup-failed","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}