{"record":{"id":"90a8e20c22be84ee","repo":"nathanmarz/storm","slug":"error-during-multilang-processing","errorCode":null,"errorMessage":"Error during multilang processing","messagePattern":"Error during multilang processing","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/task/ShellBolt.java","lineNumber":179,"sourceCode":"\n    public void execute(Tuple input) {\n        if (_exception != null) {\n            throw new RuntimeException(_exception);\n        }\n\n        //just need an id\n        String genId = Long.toString(_rand.nextLong());\n        _inputs.put(genId, input);\n        try {\n            JSONObject obj = new JSONObject();\n            obj.put(\"id\", genId);\n            obj.put(\"comp\", input.getSourceComponent());\n            obj.put(\"stream\", input.getSourceStreamId());\n            obj.put(\"task\", input.getSourceTask());\n            obj.put(\"tuple\", input.getValues());\n            _pendingWrites.put(obj);\n        } catch(InterruptedException e) {\n            throw new RuntimeException(\"Error during multilang processing\", e);\n        }\n    }\n\n    public void cleanup() {\n        _running = false;\n        _process.destroy();\n        _inputs.clear();\n    }\n\n    private void handleAck(Map action) {\n        String id = (String) action.get(\"id\");\n        Tuple acked = _inputs.remove(id);\n        if(acked==null) {\n            throw new RuntimeException(\"Acked a non-existent or already acked/failed id: \" + id);\n        }\n        _collector.ack(acked);\n    }\n","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/task/ShellBolt.java#L161-L197","documentation":"ShellBolt.execute places the incoming tuple as a JSON task on the write queue consumed by the subprocess writer thread. If _pendingWrites.put blocks and the thread is interrupted, it throws this RuntimeException. It indicates the bolt's executor thread was interrupted while waiting to hand a tuple to the multilang process, usually because the bolt is shutting down or the writer thread died.","triggerScenarios":"The bounded _pendingWrites queue is full (subprocess is slow or dead) so put() blocks, and the executor thread gets interrupted (topology shutdown, worker restart, orsuicide of the writer thread after subprocess death); interruption propagates as this RuntimeException wrapping InterruptedException.","commonSituations":"Multilang subprocess hung or crashed so it stops draining the write queue; worker shutting down/rebalancing while tuples are still in flight; extremely slow external script causing sustained queue backpressure at shutdown time.","solutions":["Check whether the subprocess is alive and consuming output — restart the topology/worker if the process hung; ensure the script reads stdin continuously and never blocks long","Look at worker logs for preceding subprocess death or ShellBolt reader-thread errors and fix the root cause (script crash, OOM)","If this occurs only during rebalance/kill, it is expected interruption — ensure your script handles SIGTERM and exits promptly","Make the bolt idempotent/able to reprocess tuples, since tuples pending at interruption are failed and replayed by the spout"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// in a wrapper around ShellBolt.execute or a delegating bolt:\ntry {\n    shellBolt.execute(input);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Error during multilang processing\")) {\n        LOG.warn(\"Multilang write queue interrupted; tuple will be replayed\", e);\n        // do not ack; allow storm to fail/replay the tuple\n    } else {\n        throw e;\n    }\n}","preventionTips":["Keep the subprocess fast and always reading stdin so the write queue drains","Monitor worker logs for subprocess death and configure topology.timeout appropriately","Make bolt processing idempotent since interrupted tuples are replayed","Handle SIGTERM in the script so it exits cleanly and doesn't wedge the writer queue"],"tags":["storm","multilang","subprocess","thread-interrupted"],"backgroundTag":"thread-interrupted","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}