Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-1835

DataNode.setNewStorageID pulls entropy from /dev/random

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.20.2
    • Fix Version/s: 0.23.0
    • Component/s: datanode
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      DataNode.setNewStorageID uses SecureRandom.getInstance("SHA1PRNG") which always pulls fresh entropy.

      It wouldn't be so bad if this were only the 120 bits needed by sha1, but the default impl of SecureRandom actually uses a BufferedInputStream around /dev/random and pulls 1024 bits of entropy for this one call.

      If you are on a system without much entropy coming in, this call can block and block others.

      Can we just change this to use "new SecureRandom().nextInt(Integer.MAX_VALUE)" instead?

        Attachments

        1. hdfs-1835.txt
          0.8 kB
          Todd Lipcon
        2. DataNode.patch
          0.9 kB
          John Carrino

          Issue Links

            Activity

              People

              • Assignee:
                johnyoh John Carrino
                Reporter:
                johnyoh John Carrino
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified