{"record":{"id":"2859fe2a6725a7b6","repo":"apache/hadoop","slug":"client-ids-not-matched-local-id-id-in-respons","errorCode":null,"errorMessage":"Client IDs not matched: local ID={}, ID in response={}","messagePattern":"Client IDs not matched: local ID=(.+?), ID in response=(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java","lineNumber":315,"sourceCode":"  \n  /**\n   * Decrement this client's reference count\n   */\n  int decAndGetCount() {\n    return refCount.decrementAndGet();\n  }\n\n  /** Check the rpc response header. */\n  void checkResponse(RpcResponseHeaderProto header) throws IOException {\n    if (header == null) {\n      throw new EOFException(\"Response is null.\");\n    }\n    if (header.hasClientId()) {\n      // check client IDs\n      final byte[] id = header.getClientId().toByteArray();\n      if (!Arrays.equals(id, RpcConstants.DUMMY_CLIENT_ID)) {\n        if (!Arrays.equals(id, clientId)) {\n          throw new IOException(\"Client IDs not matched: local ID=\"\n              + StringUtils.byteToHexString(clientId) + \", ID in response=\"\n              + StringUtils.byteToHexString(header.getClientId().toByteArray()));\n        }\n      }\n    }\n  }\n\n  Call createCall(RPC.RpcKind rpcKind, Writable rpcRequest) {\n    return new Call(rpcKind, rpcRequest);\n  }\n\n  /** \n   * Class that represents an RPC call\n   */\n  static class Call {\n    final int id;               // call id\n    final int retry;           // retry count\n    final Writable rpcRequest;  // the serialized rpc request","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java#L297-L333","documentation":"After checking the header is non-null, Client.checkResponse verifies that the clientId in the response header matches this client connection's own clientId (unless the server sent the DUMMY_CLIENT_ID). A mismatch means the response arriving on this connection belongs to a different client — the connection's framing/state is corrupted, or a proxy/server routed the response incorrectly. It throws IOException with both hex IDs for diagnosis.","triggerScenarios":"RPC stream desynchronization after a partially handled error (client reads bytes offset from message boundaries); a buggy intermediary (proxy, router, test harness) writing another client's bytes onto this connection; bugs in custom RPC pipelines reusing connections across Client instances.","commonSituations":"Rare; appears when wrapping Hadoop RPC with custom connection pooling/multiplexing, in tests faking servers, or after version-mismatch desync events; usually accompanies other preceding IO errors on the same connection.","solutions":["Treat the connection as poisoned: close it (or let the Client discard it) and retry the call on a fresh connection.","Audit any custom code that shares or pools IPC connections across clients/threads incorrectly.","Compare the two hex IDs in the message — if the 'ID in response' repeats across hosts, a misbehaving middle layer is likely.","Verify client and server run compatible Hadoop versions after any partial upgrade."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  call();\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Client IDs not matched\")) {\n    // connection state is corrupted: force reconnect and retry; do not reuse the connection\n    client.closeConnection();\n    retryOnce();\n  } else { throw e; }\n}","preventionTips":["Never share one Client/Connection across independent client identities.","Avoid custom proxies that interleave multiple clients' bytes on one socket.","After any mid-stream IOException, discard the connection instead of continuing to read from it.","Keep client/server Hadoop versions aligned during upgrades."],"tags":["hadoop","ipc","rpc-client","protocol","connection-state","debugging"],"backgroundTag":"rpc-response-corruption","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}