{"record":{"id":"907379ca3ea706f5","repo":"apache/hadoop","slug":"vecsum-failed-with-error-d-n","errorCode":null,"errorMessage":"vecsum failed with error %d\\n","messagePattern":"vecsum failed with error (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c","lineNumber":804,"sourceCode":"            goto done;\n    }\n    watch = stopwatch_create();\n    if (!watch)\n        goto done;\n    switch (opts->ty) {\n    case VECSUM_LOCAL:\n        vecsum_local(cdata, opts);\n        ret = 0;\n        break;\n    case VECSUM_LIBHDFS:\n        ret = vecsum_libhdfs(ldata, opts);\n        break;\n    case VECSUM_ZCR:\n        ret = vecsum_zcr(ldata, opts);\n        break;\n    }\n    if (ret) {\n        fprintf(stderr, \"vecsum failed with error %d\\n\", ret);\n        goto done;\n    }\n    ret = 0;\ndone:\n    fprintf(stderr, \"cleaning up...\\n\");\n    if (watch && (ret == 0)) {\n        long long length = vecsum_length(opts, ldata);\n        if (length >= 0) {\n            stopwatch_stop(watch, length * opts->passes);\n        }\n    }\n    if (cdata)\n        local_data_free(cdata);\n    if (ldata)\n        libhdfs_data_free(ldata);\n    if (opts)\n        options_free(opts);\n    return ret;","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c#L786-L822","documentation":"Top-level aggregator: after dispatching to the selected mode (local / libhdfs / zcr), main() prints this with the propagated error code and jumps to cleanup, skipping the stopwatch report. The actual failure was printed by the mode-specific code earlier on stderr.","triggerScenarios":"Any nonzero return from vecsum_local, vecsum_libhdfs or vecsum_zcr: file open failure, malloc failure, read failure, partial read, or zero-copy setup failure.","commonSituations":"First run of vecsum on a new cluster (bad paths/config); runs interrupted by cluster events; unaligned length arguments.","solutions":["Scan stderr upward for the first specific message (hdfsOpenFile failed / hadoopReadZero failed / partial read / malloc failed) — fix that.","If the cause is config-related, test with -t local to confirm the harness itself works, then move to -t libhdfs / -t zcr.","Re-run once the underlying issue is resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"/* fail fast on the common deterministic causes before dispatching */\nif (opts->ty != VECSUM_LOCAL && hdfsExists(fs, opts->path) != 0) return ENOENT;\nif (opts->ty != VECSUM_LOCAL && opts->length % VECSUM_CHUNK_SIZE) return EINVAL;","typeGuard":null,"tryCatchPattern":"switch (opts->ty) {\ncase VECSUM_LOCAL:  vecsum_local(cdata, opts); ret = 0; break;\ncase VECSUM_LIBHDFS: ret = vecsum_libhdfs(ldata, opts); break;\ncase VECSUM_ZCR:     ret = vecsum_zcr(ldata, opts); break;\n}\nif (ret) { /* ret is the propagated errno: log the FIRST specific stderr line\n              above, classify (config vs transient vs alignment), then decide\n              whether a restart of the run is worthwhile */ }","preventionTips":["Treat this code as a summary: always diagnose the first mode-specific error line above it.","Wrap benchmark scripts so a nonzero exit maps to the underlying category (config/alignment/cluster) for reporting.","Run a tiny smoke invocation (small aligned -l, 1 pass) before long benchmark runs to surface config errors early."],"tags":["hdfs","vecsum","wrapper","exit-code"],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}