{"record":{"id":"744b2765c356a88a","repo":"apache/hadoop","slug":"enomem-744b27","errorCode":"ENOMEM","errorMessage":"hadoopRzOptionsAlloc failed.\\n","messagePattern":"hadoopRzOptionsAlloc failed\\.\\\\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":625,"sourceCode":"    }\n    printf(\"finished zcr pass %d.  sum = %g\\n\", pass, sum);\n    ret = 0;\n\ndone:\n    if (rzbuf)\n        hadoopRzBufferFree(ldata->file, rzbuf);\n    return ret;\n}\n\nstatic int vecsum_zcr(struct libhdfs_data *ldata,\n        const struct options *opts)\n{\n    int ret, pass;\n    struct hadoopRzOptions *zopts = NULL;\n\n    zopts = hadoopRzOptionsAlloc();\n    if (!zopts) {\n        fprintf(stderr, \"hadoopRzOptionsAlloc failed.\\n\");\n        ret = ENOMEM;\n        goto done;\n    }\n    if (hadoopRzOptionsSetSkipChecksum(zopts, 1)) {\n        ret = errno;\n        perror(\"hadoopRzOptionsSetSkipChecksum failed: \");\n        goto done;\n    }\n    if (hadoopRzOptionsSetByteBufferPool(zopts, NULL)) {\n        ret = errno;\n        perror(\"hadoopRzOptionsSetByteBufferPool failed: \");\n        goto done;\n    }\n    for (pass = 0; pass < opts->passes; ++pass) {\n        ret = vecsum_zcr_loop(pass, ldata, zopts, opts);\n        if (ret) {\n            fprintf(stderr, \"vecsum_zcr_loop pass %d failed \"\n                \"with error %d\\n\", pass, ret);","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c#L607-L643","documentation":"hadoopRzOptionsAlloc() only calloc()s a small hadoopRzOptions struct; a NULL return means the allocation failed. vecsum maps this directly to ENOMEM and skips zero-copy setup.","triggerScenarios":"The process cannot allocate memory at calloc() time: address-space limits (ulimit -v), cgroup/container memory caps, overcommit settings, or a host already deep into memory pressure. Because the struct is tiny, seeing this error indicates severe systemic memory exhaustion, not a big request.","commonSituations":"Running native libhdfs benchmarks inside containers with tight memory limits; test hosts with restrictive RLIMIT_AS; ulimit -v set by CI sandboxes.","solutions":["Check ulimit -v and raise it or remove it; inside containers, raise the memory limit.","Free memory on the host and retry; check dmesg for OOM-killer activity.","If persistent, reduce other memory usage of the benchmark (fewer passes, smaller -l length)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"/* cheap preflight: can we still allocate at all? */\nvoid *p = malloc(4096);\nif (!p) { /* host is out of memory — do not start the run */ }\nfree(p);","typeGuard":null,"tryCatchPattern":"zopts = hadoopRzOptionsAlloc();\nif (!zopts) {\n    if (errno == ENOMEM) { sleep(1); zopts = hadoopRzOptionsAlloc(); } /* one bounded retry */\n    if (!zopts) { /* give up with ENOMEM */ }\n}","preventionTips":["Run native benchmarks with realistic memory limits (check ulimit -v and container caps beforehand).","Prefer one bounded retry on ENOMEM for tiny allocations; persistent failure means systemic memory pressure.","Monitor host memory before launching concurrent benchmark instances."],"tags":["libhdfs","c","errno","memory","vecsum","zero-copy"],"backgroundTag":"memory-allocation-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}