{"record":{"id":"25b5883fc439dc19","repo":"apache/cassandra","slug":"hintsservice-is-shut-down-and-can-t-accept-new-hin","errorCode":null,"errorMessage":"HintsService is shut down and can't accept new hints","messagePattern":"HintsService is shut down and can't accept new hints","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/hints/HintsService.java","lineNumber":190,"sourceCode":"\n        return builder.build();\n    }\n\n    public void registerMBean()\n    {\n        MBeanWrapper.instance.registerMBean(this, MBEAN_NAME);\n    }\n\n    /**\n     * Write a hint for a iterable of nodes.\n     *\n     * @param hostIds host ids of the hint's target nodes\n     * @param hint the hint to store\n     */\n    public void write(Collection<UUID> hostIds, Hint hint)\n    {\n        if (isShutDown)\n            throw new IllegalStateException(\"HintsService is shut down and can't accept new hints\");\n\n        // we have to make sure that the HintsStore instances get properly initialized - otherwise dispatch will not trigger\n        catalog.maybeLoadStores(hostIds);\n\n        bufferPool.write(hostIds, hint);\n\n        StorageMetrics.totalHints.inc(hostIds.size());\n    }\n\n    /**\n     * Write a hint for a single node.\n     *\n     * @param hostId host id of the hint's target node\n     * @param hint the hint to store\n     */\n    public void write(UUID hostId, Hint hint)\n    {\n        write(Collections.singleton(hostId), hint);","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/hints/HintsService.java#L172-L208","documentation":"IllegalStateException thrown by HintsService.write when hints are being written after the service has been shut down. Once isShutDown is set (during node shutdown), the write path refuses new hints to avoid writing after resources were released.","triggerScenarios":"Calling HintsService.write() (directly or via writeForAllReplicas) after HintsService.shutdownBlocking() — e.g. custom code writing hints during shutdown, or race between mutation handling and shutdown.","commonSituations":"Batches/batchlog writing hints concurrently with node decommission/stop; plugin or test code calling the hints API late in the lifecycle.","solutions":["Ensure hint writes stop before shutdown is initiated (drain writes first)","Guard calls with a lifecycle check (catch IllegalStateException and drop the hint — hints are best-effort)","In tests, shut down HintsService last, after all producers complete","If hit on a live node unexpectedly, check for a shutdown/restart bug in node lifecycle (report with logs)"],"exampleFix":"// before\nHintsService.instance.write(hostIds, hint);\n// after\ntry {\n    HintsService.instance.write(hostIds, hint);\n} catch (IllegalStateException e) {\n    // hints are best-effort; dropping during shutdown is acceptable\n}","handlingStrategy":"try-catch","validationCode":"// producer-side check before writing\nif (HintsService.instance.isShutDown()) { logger.debug(\"Dropping hint: service shut down\"); return; }","typeGuard":"boolean canWriteHints() { return !HintsService.instance.isShutDown(); }","tryCatchPattern":"try {\n    HintsService.instance.write(hostIds, hint);\n} catch (IllegalStateException e) {\n    logger.debug(\"Hints service shut down; dropping hint (best-effort)\");\n}","preventionTips":["Treat hints as best-effort; never depend on them for correctness","Stop hint producers before initiating shutdown","In tests, close the cluster rather than manually shutting down the service","Add lifecycle assertions to custom code writing hints"],"tags":["lifecycle","shutdown","hints"],"backgroundTag":"invalid-state-transition","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}