{"record":{"id":"e06ade6369504035","repo":"apache/hadoop","slug":"cannot-find-bpofferservice-for-bpid","errorCode":null,"errorMessage":"cannot find BPOfferService for bpid={}","messagePattern":"cannot find BPOfferService for bpid=(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java","lineNumber":2345,"sourceCode":"  /**\n   * @return the datanode's IPC port\n   */\n  public int getIpcPort() {\n    return ipcServer.getListenerAddress().getPort();\n  }\n  \n  /**\n   * get BP registration by blockPool id\n   * @return BP registration object\n   * @throws IOException on error\n   */\n  @VisibleForTesting\n  public DatanodeRegistration getDNRegistrationForBP(String bpid) \n  throws IOException {\n    DataNodeFaultInjector.get().noRegistration();\n    BPOfferService bpos = blockPoolManager.get(bpid);\n    if(bpos==null || bpos.bpRegistration==null) {\n      throw new IOException(\"cannot find BPOfferService for bpid=\"+bpid);\n    }\n    return bpos.bpRegistration;\n  }\n  \n  /**\n   * Creates either NIO or regular depending on socketWriteTimeout.\n   */\n  public Socket newSocket() throws IOException {\n    return socketFactory.createSocket();\n  }\n\n  /**\n   * Connect to the NN. This is separated out for easier testing.\n   */\n  DatanodeProtocolClientSideTranslatorPB connectToNN(\n      InetSocketAddress nnAddr) throws IOException {\n    return new DatanodeProtocolClientSideTranslatorPB(nnAddr, getConf());\n  }","sourceCodeStart":2327,"sourceCodeEnd":2363,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2327-L2363","documentation":"Error \"cannot find BPOfferService for bpid={}\" thrown in apache/hadoop.","triggerScenarios":"An operation references a block pool id for which no BPOfferService thread exists on this DataNode.","commonSituations":"No offer-service thread exists for the given block pool, typically after refreshNamenodes removed it or a race during shutdown. Verify the block pool configuration.","solutions":["Confirm the block pool id is correct and that the DataNode has completed handshake/registration with that NameNode before issuing the command.","Run refreshNamenodes and retry; the BPOfferService may not have been created yet for a newly added nameservice."],"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"}