{"record":{"id":"3afa87e84cf1f1ce","repo":"apache/hadoop","slug":"can-t-handle-old-inotify-server-response","errorCode":null,"errorMessage":"Can't handle old inotify server response.","messagePattern":"Can't handle old inotify server response\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java","lineNumber":882,"sourceCode":"      return new BlockStoragePolicy[0];\n    }\n    BlockStoragePolicy[] policies = new BlockStoragePolicy[policyProtos.size()];\n    int i = 0;\n    for (BlockStoragePolicyProto proto : policyProtos) {\n      policies[i++] = convert(proto);\n    }\n    return policies;\n  }\n\n  public static EventBatchList convert(GetEditsFromTxidResponseProto resp)\n      throws IOException {\n    final InotifyProtos.EventsListProto list = resp.getEventsList();\n    final long firstTxid = list.getFirstTxid();\n    final long lastTxid = list.getLastTxid();\n\n    List<EventBatch> batches = Lists.newArrayList();\n    if (list.getEventsList().size() > 0) {\n      throw new IOException(\"Can't handle old inotify server response.\");\n    }\n    for (InotifyProtos.EventBatchProto bp : list.getBatchList()) {\n      long txid = bp.getTxid();\n      if ((txid != -1) && ((txid < firstTxid) || (txid > lastTxid))) {\n        throw new IOException(\"Error converting TxidResponseProto: got a \" +\n            \"transaction id \" + txid + \" that was outside the range of [\" +\n            firstTxid + \", \" + lastTxid + \"].\");\n      }\n      List<Event> events = Lists.newArrayList();\n      for (InotifyProtos.EventProto p : bp.getEventsList()) {\n        switch (p.getType()) {\n        case EVENT_CLOSE:\n          InotifyProtos.CloseEventProto close =\n              InotifyProtos.CloseEventProto.parseFrom(p.getContents());\n          events.add(new Event.CloseEvent(close.getPath(),\n              close.getFileSize(), close.getTimestamp()));\n          break;\n        case EVENT_CREATE:","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java#L864-L900","documentation":"When converting a GetEditsFromTxidResponseProto, the client finds the deprecated EventsListProto.events field populated instead of the batchList field. That layout belongs to an old pre-batching NameNode (pre-2.6 inotify protocol); modern clients can only decode EventBatchProto batches and refuse the old format with an IOException.","triggerScenarios":"A modern client calls getEditsFromTxid / DFSInotifyEventInputStream against a NameNode old enough to return raw events; list.getEventsList().size() > 0 trips the guard during PBHelperClient.convert.","commonSituations":"Application bundling newer hadoop-client jars against a legacy cluster; test harnesses pointed at old clusters; using inotify before event batching stabilized.","solutions":["Upgrade the NameNode/cluster to a version with batched inotify events (Hadoop 2.6+)","Or use a client version matching the cluster and do not use the inotify API there","Feature-detect the server version before relying on inotify"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before relying on inotify, require a server that emits batched events\nif (serverVersionIsOlderThan(\"2.6.0\")) {\n  usePollingOrUpgrade(); // avoid getEditsFromTxid against old NameNodes\n}","typeGuard":null,"tryCatchPattern":"catch (IOException e) with message containing \"old inotify server response\": stop using inotify against this cluster; no retry can succeed.","preventionTips":["Match client and cluster Hadoop versions for inotify consumers","Feature-detect server capabilities at application startup"],"tags":["hdfs","inotify","version-skew","backward-compatibility"],"backgroundTag":"server-version-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}