{"record":{"id":"a5a834164fdfd298","repo":"apache/hadoop","slug":"vecsum-length-stat-s-failed-error-d-s-n","errorCode":null,"errorMessage":"vecsum_length: stat(%s) failed: error %d (%s)\\n","messagePattern":"vecsum_length: stat\\((.+?)\\) failed: error (.+?) \\((.+?)\\)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c","lineNumber":745,"sourceCode":"\nstatic void vecsum_local(struct local_data *cdata, const struct options *opts)\n{\n    int pass;\n\n    for (pass = 0; pass < opts->passes; pass++) {\n        double sum = vecsum(cdata->mmap, cdata->length / sizeof(double));\n        printf(\"finished vecsum_local pass %d.  sum = %g\\n\", pass, sum);\n    }\n}\n\nstatic long long vecsum_length(const struct options *opts,\n                const struct libhdfs_data *ldata)\n{\n    if (opts->ty == VECSUM_LOCAL) {\n        struct stat st_buf = { 0 };\n        if (stat(opts->path, &st_buf)) {\n            int err = errno;\n            fprintf(stderr, \"vecsum_length: stat(%s) failed: \"\n                \"error %d (%s)\\n\", opts->path, err, strerror(err));\n            return -EIO;\n        }\n        return st_buf.st_size;\n    } else {\n        return ldata->length;\n    }\n}\n\n/*\n * vecsum is a microbenchmark which measures the speed of various ways of\n * reading from HDFS.  It creates a file containing floating-point 'doubles',\n * and computes the sum of all the doubles several times.  For some CPUs,\n * assembly optimizations are used for the summation (SSE, etc).\n */\nint main(void)\n{\n    int ret = 1;","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c#L727-L763","documentation":"After the timed run finishes, vecsum_length() stats the local backing file (VECSUM_LOCAL mode) to compute throughput for the stopwatch report. If stat() fails it prints this message and returns -EIO; main() then simply skips the rate report — the benchmark result itself has already completed.","triggerScenarios":"The local mmap-backed file (opts->path) was deleted or made inaccessible between the run and the measurement, e.g. tmpwatch/systemd-tmpfiles cleaning /tmp, another process removing the file, or permission changes.","commonSituations":"Running vecsum in local mode against a file in /tmp on hosts with aggressive tmp cleaners; running in a directory removed by a cleanup script mid-run.","solutions":["Place the local test file outside auto-cleaned directories like /tmp.","Ensure the file persists and stays readable for the whole vecsum run.","If it only recurs, check for other actors: lsof / audit on the path."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"/* in local mode, stat the file before starting the run */\nstruct stat st;\nif (stat(opts->path, &st) || st.st_size != opts->length) {\n    fprintf(stderr, \"local file %s missing or wrong size\\n\", opts->path);\n    return -1;\n}","typeGuard":null,"tryCatchPattern":"long long len = vecsum_length(opts, ldata);\nif (len < 0) {\n    /* -EIO: only the throughput report is lost; the run result is still valid.\n       Log and continue rather than failing the whole benchmark. */\n}","preventionTips":["Put local benchmark files outside /tmp and other auto-cleaned directories.","Ensure the file's ownership/permissions stay stable for the full run.","Treat vecsum_length failure as non-fatal — the timing data is already collected."],"tags":["libhdfs","c","vecsum","local-mode","stat","errno"],"backgroundTag":"file-stat-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}