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

UserGroupInformation equals method depend on the subject object address

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.1
    • None
    • security
    • None

    Description

      my question is why UserGroupInformation equals method depend on the subject object?

      try below code which is extract from HiveMetaStore:

      TestUgi.java
      UserGroupInformation clientUgi = null;
      UserGroupInformation clientUgi2 = null;
      try {
      clientUgi = UserGroupInformation.createProxyUser("user2", UserGroupInformation.getLoginUser());
      clientUgi2 = UserGroupInformation.createProxyUser("user2", UserGroupInformation.getLoginUser());
      if (clientUgi.equals(clientUgi2)) {
      System.out.println("==");
      } else {
      System.out.println("!=");           //  strangely  this will be hit
      }
      } catch (IOException e1) {
      e1.printStackTrace();
      }
      

      i found that it is because the equal method from UserGroupInformation is compare on subject object ref : subject == ((UserGroupInformation) o).subject; .

      as you know, ipc.Client connect to namenode, connections.get(ConnectionId) this code will try to reuse the same socket to namenode, but because of ConnectionId's equal depend on ugi equal, which will cause connections.get(ConnectionId) cann't get the same socket, suppose many connect to HiveMetaStore, then many connection to Namenode will established.

      so my doubts is why UserGroupInformation is compare on subject object ref : subject == ((UserGroupInformation) o).subject, it should compare on subject's principal, am i right?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              wenli wangwenli
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated: