apache/hadoop · error · RuntimeException

failed to fill reservoir

Error message

failed to fill reservoir

What it means

Error "failed to fill reservoir" thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/random/OsSecureRandom.java:69

  private final int RESERVOIR_LENGTH = 8192;

  private String randomDevPath;

  private transient InputStream stream;

  private final byte[] reservoir = new byte[RESERVOIR_LENGTH];

  private int pos = reservoir.length;

  private void fillReservoir(int min) {
    if (pos >= reservoir.length - min) {
      try {
        if (stream == null) {
          stream = Files.newInputStream(Paths.get(randomDevPath));
        }
        IOUtils.readFully(stream, reservoir, 0, reservoir.length);
      } catch (IOException e) {
        throw new RuntimeException("failed to fill reservoir", e);
      }
      pos = 0;
    }
  }

  public OsSecureRandom() {
  }

  @VisibleForTesting
  public boolean isClosed() {
    return stream == null;
  }

  @Override
  synchronized public void setConf(Configuration conf) {
    this.conf = conf;
    this.randomDevPath = conf.get(
        HADOOP_SECURITY_SECURE_RANDOM_DEVICE_FILE_PATH_KEY,

View on GitHub (pinned to 2add963021)

Solutions

  1. The OS secure random reservoir could not be filled from /dev/random; check entropy or the os.secure.random.device setting.

Example fix

Set hadoop.security.random.device.file.path to /dev/urandom.

When it happens

Trigger: Raised at runtime when the documented precondition or configuration requirement for this operation is violated.

Common situations: Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.


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