Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-19118

KeyShell fails with NPE when KMS throws Exception with null as message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.3.6
    • None
    • common, crypto
    • None

    Description

      There is an issue in specific Ranger versions (where RANGER-3989 is not fixed) which throws Exception in case of concurrent access to a HashMap with Message null.

      java.util.ConcurrentModificationException: null
              at java.util.HashMap$HashIterator.nextNode(HashMap.java:1469)
              at java.util.HashMap$EntryIterator.next(HashMap.java:1503)
              at java.util.HashMap$EntryIterator.next(HashMap.java:1501) 

      This manifests in Hadoop's KeyShell as an Exception with message null.

      So when

        private String prettifyException(Exception e) {
          return e.getClass().getSimpleName() + ": " +
              e.getLocalizedMessage().split("\n")[0];
        } 

      tries to print out the Exception the user experiences NPE

      Exception in thread "main" java.lang.NullPointerException
      	at org.apache.hadoop.crypto.key.KeyShell.prettifyException(KeyShell.java:541)
      	at org.apache.hadoop.crypto.key.KeyShell.printException(KeyShell.java:536)
      	at org.apache.hadoop.tools.CommandShell.run(CommandShell.java:79)
      	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:81)
      	at org.apache.hadoop.crypto.key.KeyShell.main(KeyShell.java:553) 

      This is an unwanted behaviour because the user does not have any feedback what and where went wrong.

       

      My suggestion is to add null checking into the affected prettifyException method.

      I'll create the Github PR soon.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dionusos Dénes Bodó
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: