{"record":{"id":"59a97af39f911199","repo":"apache/hadoop","slug":"hdfsconnfree-username-s-hdfsdisconnect-failed-w","errorCode":null,"errorMessage":"hdfsConnFree(username=%s): hdfsDisconnect failed with error %d\n","messagePattern":"hdfsConnFree\\(username=(.+?)\\): hdfsDisconnect failed with error (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c","lineNumber":240,"sourceCode":"  exemplar.usrname = (char*)usrname;\n  exemplar.kpath = (char*)kpath;\n  return RB_FIND(hdfsConnTree, &gConnTree, &exemplar);\n}\n\n/**\n * Free the resource associated with a libhdfs connection.\n *\n * You must remove the connection from the tree before calling this function.\n *\n * @param conn            The libhdfs connection\n */\nstatic void hdfsConnFree(struct hdfsConn *conn)\n{\n  int ret;\n\n  ret = hdfsDisconnect(conn->fs);\n  if (ret) {\n    fprintf(stderr, \"hdfsConnFree(username=%s): \"\n      \"hdfsDisconnect failed with error %d\\n\",\n      (conn->usrname ? conn->usrname : \"(null)\"), ret);\n  }\n  free(conn->usrname);\n  free(conn->kpath);\n  free(conn);\n}\n\n/**\n * Convert a time_t to a string.\n *\n * @param sec           time in seconds since the epoch\n * @param buf           (out param) output buffer\n * @param bufLen        length of output buffer\n *\n * @return              0 on success; ENAMETOOLONG if the provided buffer was\n *                      too short\n */","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c#L222-L258","documentation":"Error \"hdfsConnFree(username=%s): hdfsDisconnect failed with error %d\n\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c:240 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the libhdfs connection state; retry hdfsDisconnect or free the connection handle with hdfsConnFreeOnly after confirming no in-flight operations use it.","Inspect errno/error code returned; ensure the underlying JVM is still alive before disconnecting."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}