{"record":{"id":"a7501e4e13e813c0","repo":"apache/cassandra","slug":"command","errorCode":null,"errorMessage":"Command ","messagePattern":"Command ","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/utils/FBUtilities.java","lineNumber":1280,"sourceCode":"                completed = true;\n            }\n            else\n            {\n                completed = process.waitFor(timeout.toMillis(), TimeUnit.MILLISECONDS);\n            }\n\n            copy(process.getInputStream(), out, outBufSize);\n            long outOverflow = process.getInputStream().transferTo(overflowSink);\n\n            copy(process.getErrorStream(), err, errBufSize);\n            long errOverflow = process.getErrorStream().transferTo(overflowSink);\n\n            if (!completed)\n            {\n                process.destroyForcibly();\n                logger.error(\"Command {} did not complete in {}, killed forcibly:\\noutput:\\n{}\\n(truncated {} bytes)\\nerror:\\n{}\\n(truncated {} bytes)\",\n                             Arrays.toString(cmd), timeout, out.asString(), outOverflow, err.asString(), errOverflow);\n                throw new TimeoutException(\"Command \" + Arrays.toString(cmd) + \" did not complete in \" + timeout);\n            }\n            int r = process.exitValue();\n            if (r != 0)\n            {\n                logger.error(\"Command {} failed with exit code {}:\\noutput:\\n{}\\n(truncated {} bytes)\\nerror:\\n{}\\n(truncated {} bytes)\",\n                             Arrays.toString(cmd), r, out.asString(), outOverflow, err.asString(), errOverflow);\n                throw new IOException(\"Command \" + Arrays.toString(cmd) + \" failed with exit code \" + r);\n            }\n            return out.asString();\n        }\n    }\n\n    public static void updateChecksumShort(Checksum checksum, short v)\n    {\n        checksum.update((v >>> 8) & 0xFF);\n        checksum.update((v >>> 0) & 0xFF);\n    }\n","sourceCodeStart":1262,"sourceCodeEnd":1298,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/FBUtilities.java#L1262-L1298","documentation":"The timeout-aware FBUtilities.exec variant waits for an external command to finish within a given duration. If the process does not complete in time it is destroyed forcibly and a TimeoutException with this message is thrown. It indicates the external tool was too slow or hung.","triggerScenarios":"Calling the timeout-based FBUtilities.exec(cmd, timeout, ...) where the spawned command does not exit within the timeout, e.g. an external tool blocking on stdin, deadlocked, or working on data far larger than expected.","commonSituations":"Slow disks making external tools exceed tight timeouts, tools waiting for input (no stdin closed), hung native helpers, or timeouts configured too aggressively for large datasets.","solutions":["Increase the timeout parameter to a value appropriate for the data size","Ensure the external command does not wait on stdin or interactive input","Investigate why the tool is slow/hung using the logged partial output","Retry with a smaller working set or handle the timeout gracefully in the caller"],"exampleFix":"// before: FBUtilities.exec(cmd, timeout, TimeUnit.SECONDS) with timeout = 5\n// after:  FBUtilities.exec(cmd, 300, TimeUnit.SECONDS) // allow long-running tool to finish","handlingStrategy":"retry","validationCode":"long expectedMs = estimateRuntime(workSize); if (expectedMs > timeoutMs) throw new IllegalStateException(\"timeout \" + timeoutMs + \"ms too small for work size\");","typeGuard":null,"tryCatchPattern":"try { return FBUtilities.exec(cmd, timeout, TimeUnit.SECONDS); } catch (TimeoutException e) { logger.warn(\"Command timed out, retrying with longer timeout\", e); return FBUtilities.exec(cmd, timeout * 4, TimeUnit.SECONDS); }","preventionTips":["Size timeouts to the worst-case data volume, not the average case","Ensure commands never read stdin or prompt interactively","Alert on long-running external commands before the timeout hits"],"tags":["timeout","process-execution","command"],"backgroundTag":"request-timeout","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}