apache/hadoop · error

testRecursiveJvmMutex failed

Error message

testRecursiveJvmMutex failed

What it means

Error "testRecursiveJvmMutex failed " thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_threaded.c:429

    return 0;
}

/**
 * Test that we can write a file with libhdfs and then read it back
 */
int main(void)
{
    int i, tlhNumThreads;
    const char *tlhNumThreadsStr;
    struct tlhThreadInfo ti[TLH_MAX_THREADS];
    struct NativeMiniDfsConf conf = {
        1, /* doFormat */
    };

    /* Check that the recursive mutex works as expected */
    if (testRecursiveJvmMutex() < 0) {
        fprintf(stderr, "testRecursiveJvmMutex failed\n");
        return EXIT_FAILURE;
    }

    tlhNumThreadsStr = getenv("TLH_NUM_THREADS");
    if (!tlhNumThreadsStr) {
        tlhNumThreadsStr = "3";
    }
    tlhNumThreads = atoi(tlhNumThreadsStr);
    if ((tlhNumThreads <= 0) || (tlhNumThreads > TLH_MAX_THREADS)) {
        fprintf(stderr, "testLibHdfs: must have a number of threads "
                "between 1 and %d inclusive, not %d\n",
                TLH_MAX_THREADS, tlhNumThreads);
        return EXIT_FAILURE;
    }
    memset(&ti[0], 0, sizeof(ti));
    for (i = 0; i < tlhNumThreads; i++) {
        ti[i].threadIdx = i;
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Look at the earlier 'getJNIEnv failed' message for the root cause; this line is only the test verdict.
  2. Ensure the libjvm library path (LD_LIBRARY_PATH/LIBHDFS_OPTS) is correct so JNI attach can succeed.

When it happens

Trigger: Printed at the end of testRecursiveJvmMutex when recursive acquisition of the JVM mutex via getJNIEnv failed.

Common situations: Follows a failed getJNIEnv call in the recursive mutex unit test, usually due to missing or destroyed JVM state.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/549804e012cb6307. Report an issue: GitHub.