Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-11935

Race condition in HiveMetaStoreClient: isCompatibleWith and close

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 1.3.0, 2.1.0
    • Metastore
    • None
    • Reviewed

    Description

      We saw intermittent failure of the following stack:

      java.lang.NullPointerException
              at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.isCompatibleWith(HiveMetaStoreClient.java:287)
              at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:497)
              at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:156)
              at com.sun.proxy.$Proxy9.isCompatibleWith(Unknown Source)
              at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:206)
              at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.createHiveDB(BaseSemanticAnalyzer.java:205)
              at org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.<init>(DDLSemanticAnalyzer.java:223)
              at org.apache.hadoop.hive.ql.parse.SemanticAnalyzerFactory.get(SemanticAnalyzerFactory.java:259)
              at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:409)
              at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:308)
              at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1122)
              at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1116)
              at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:110)
              at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:181)
              at org.apache.hive.service.cli.operation.Operation.run(Operation.java:257)
              at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:388)
              at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:375)
              at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:497)
              at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
              at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:36)
              at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:63)
              at java.security.AccessController.doPrivileged(Native Method)
              at javax.security.auth.Subject.doAs(Subject.java:422)
              at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
              at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:59)
              at com.sun.proxy.$Proxy20.executeStatementAsync(Unknown Source)
              at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:274)
              at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:486)
              at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
              at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
              at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
              at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
              at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
              at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
              at org.apache.thrift.server.TServlet.doPost(TServlet.java:83)
              at org.apache.hive.service.cli.thrift.ThriftHttpServlet.doPost(ThriftHttpServlet.java:171)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
              at org.eclipse.jetty.server.Server.handle(Server.java:349)
              at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
              at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
              at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
              at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
              at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
              at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
              at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      

      HiveMetaStoreClient.isCompatibleWith does a null check of currentMetaVars in the beginning, but it is possible HiveMetaStoreClient.close is invoked before it gets used, thus we will see the above stack. Access of currentMetaVars should be synchronized.

      Attachments

        1. HIVE-11935.1.patch
          1 kB
          Daniel Dai
        2. HIVE-11935.2.patch
          1 kB
          Daniel Dai

        Activity

          People

            daijy Daniel Dai
            daijy Daniel Dai
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: