apache/hadoop · error · IOException

cannot find BPOfferService for bpid=

Error message

cannot find BPOfferService for bpid={}

What it means

getDNRegistrationForBP looks up the BPOfferService and its registration for a block pool id; this fires when no such service is running or its registration is not yet set, e.g. unknown bpid or before registration.

Solutions

  1. Confirm the block pool id is correct and that the DataNode has completed handshake/registration with that NameNode before issuing the command.
  2. Run refreshNamenodes and retry; the BPOfferService may not have been created yet for a newly added nameservice.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: An operation references a block pool id for which no BPOfferService thread exists on this DataNode.

Common situations: 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.


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java:2345

  /**
   * @return the datanode's IPC port
   */
  public int getIpcPort() {
    return ipcServer.getListenerAddress().getPort();
  }
  
  /**
   * get BP registration by blockPool id
   * @return BP registration object
   * @throws IOException on error
   */
  @VisibleForTesting
  public DatanodeRegistration getDNRegistrationForBP(String bpid) 
  throws IOException {
    DataNodeFaultInjector.get().noRegistration();
    BPOfferService bpos = blockPoolManager.get(bpid);
    if(bpos==null || bpos.bpRegistration==null) {
      throw new IOException("cannot find BPOfferService for bpid="+bpid);
    }
    return bpos.bpRegistration;
  }
  
  /**
   * Creates either NIO or regular depending on socketWriteTimeout.
   */
  public Socket newSocket() throws IOException {
    return socketFactory.createSocket();
  }

  /**
   * Connect to the NN. This is separated out for easier testing.
   */
  DatanodeProtocolClientSideTranslatorPB connectToNN(
      InetSocketAddress nnAddr) throws IOException {
    return new DatanodeProtocolClientSideTranslatorPB(nnAddr, getConf());
  }

View on GitHub (pinned to 2add963021)