You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Shawn Weeks <sw...@weeksconsulting.us> on 2019/03/04 19:16:39 UTC

Custom UDF Loses Depenencies

Are there any known gotchas with Hive UDFs that included shaded dependencies in their jar. I've got an issue where I've built a an xml udtf based on Saxon HE and after some period of time the hive server starts raising this exception. The function is created using the permanent function syntax referencing a jar in HDFS. The jar works initially and then goes to failing after the instance has been up for a few days. I've verified that the jar the function uses has these classes in there.

I'm on Hive 1.2.1 with HDP 2.6.5 patches

Thanks
Shawn Weeks

2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for /cliservice
java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
        at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
        at net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
        at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
        at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
        at net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
        at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
        at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
        at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
        at xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
        at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
        at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
        at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
        at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
        at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
        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:206)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Re: FW: Custom UDF Loses Depenencies

Posted by Kevin Risden <kr...@apache.org>.
Yea that sounds familiar. At my previous company we were trying to load
JDBC drivers with a JDBC Storage Handler in Hive. We wanted it to be
dynamic. To be completely honest, I don't know what the final solution we
ended up with was though.

We looked at aux jars instead of ADD JAR. It think it also mattered if it
was a local jar vs a jar on HDFS.

Sorry I don't have more info for you :/ I wanted to make sure you knew you
weren't crazy and I've seen similar things.

Kevin Risden


On Tue, Mar 5, 2019 at 6:37 PM Shawn Weeks <sw...@weeksconsulting.us>
wrote:

> Ok maybe this scenario will sound familiar. I’ve written a quick and dirty
> groovy udf that prints out the current class path by iterating over
> this.class.classLoader and here is what I’m seeing.
>
>
>
>    1. !connect – Class Path Printer shows no instances of the jar in the
>    class path
>    2. Execute select using xml_explode – Class Path Printer shows a
>    single instance of the jar matching the one shown by list jars
>    3. It works
>    4. !reconnect – Class Path Printer shows 46 instances of the jar in
>    the class path
>    5. Execute select using xml_explode
>    6. NoClassDefFound
>    7. !reconnect
>    8. delete jars; - For some reason this has to be the first command run
>    9. Execute select using xml_explode – Class path print shows 1
>    instances of the jar.
>    10. It works
>
>
>
> Thanks
>
> Shawn
>
>
>
> *From:* Shawn Weeks <sw...@weeksconsulting.us>
> *Sent:* Tuesday, March 5, 2019 4:04 PM
> *To:* user@hive.apache.org
> *Subject:* RE: FW: Custom UDF Loses Depenencies
>
>
>
> I suspect it’s related to that. HIVE-11878 was for several of those issues
> but it’s included in my build. The function has worked fine for months in
> some environments and if we restart Hiveserver2 it will go back to working.
> I suspect it has to do with how jar shading works but I didn’t want to
> pollute the class path.
>
>
>
> Thanks
>
>
>
> Thanks
>
> Shawn
>
>
>
>
> *From:*
> *Kevin Risden*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * <krisden@apache.org <kr...@apache.org>> Sent: Tuesday, March 5, 2019
> 3:49 PM To: user@hive.apache.org <us...@hive.apache.org> Subject: Re: FW:
> Custom UDF Loses Depenencies   Different classloader potentially inside
> HS2? I know there used to be some interesting cases of classloading when
> trying to add custom UDFs. Not sure what the current state is.  Kevin
> Risden     On Tue, Mar 5, 2019 at 4:46 PM Shawn Weeks
> <sweeks@weeksconsulting.us <sw...@weeksconsulting.us>> wrote: Didn't here
> anything on the dev mailing list, has anyone here seen this scenario.
> Custom Hive Function starts throwing class not found errors but only after
> a while, the function runs fine most of the time and only has a single
> dependency. Thanks Shawn -----Original Message----- From: Shawn Weeks
> <sweeks@weeksconsulting.us <sw...@weeksconsulting.us>> Sent: Monday, March
> 4, 2019 1:17 PM To: dev@hive.apache.org <de...@hive.apache.org> Subject:
> Custom UDF Loses Depenencies Are there any known gotchas with Hive UDFs
> that included shaded dependencies in their jar. I've got an issue where
> I've built a an xml udtf based on Saxon HE and after some period of time
> the hive server starts raising this exception. The function is created
> using the permanent function syntax referencing a jar in HDFS. The jar
> works initially and then goes to failing after the instance has been up for
> a few days. I've verified that the jar the function uses has these classes
> in there. I'm on Hive 1.2.1 with HDP 2.6.5 patches Thanks Shawn Weeks
> 2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]:
> servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for
> /cliservice java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
>         at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
>         at
> net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
>         at
> net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
> at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)         at
> net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
>         at
> net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
>         at
> net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
>       at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
>       at
> xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
>         at
> org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
>         at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
>         at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
>         at
> org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
>         at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
>   at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)         at
> org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
> at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
>     at
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
>         at
> org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
>         at
> org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
>     at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
>         at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
>         at
> org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
>         at
> org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
>         at
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
>         at
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
>         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:206)
>         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:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748) *
>

RE: FW: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
Ok maybe this scenario will sound familiar. I’ve written a quick and dirty groovy udf that prints out the current class path by iterating over this.class.classLoader and here is what I’m seeing.


  1.  !connect – Class Path Printer shows no instances of the jar in the class path
  2.  Execute select using xml_explode – Class Path Printer shows a single instance of the jar matching the one shown by list jars
  3.  It works
  4.  !reconnect – Class Path Printer shows 46 instances of the jar in the class path
  5.  Execute select using xml_explode
  6.  NoClassDefFound
  7.  !reconnect
  8.  delete jars; - For some reason this has to be the first command run
  9.  Execute select using xml_explode – Class path print shows 1 instances of the jar.
  10. It works

Thanks
Shawn

From: Shawn Weeks <sw...@weeksconsulting.us>
Sent: Tuesday, March 5, 2019 4:04 PM
To: user@hive.apache.org
Subject: RE: FW: Custom UDF Loses Depenencies

I suspect it’s related to that. HIVE-11878 was for several of those issues but it’s included in my build. The function has worked fine for months in some environments and if we restart Hiveserver2 it will go back to working. I suspect it has to do with how jar shading works but I didn’t want to pollute the class path.

Thanks

Thanks
Shawn

From: Kevin Risden <kr...@apache.org>>
Sent: Tuesday, March 5, 2019 3:49 PM
To: user@hive.apache.org<ma...@hive.apache.org>
Subject: Re: FW: Custom UDF Loses Depenencies

Different classloader potentially inside HS2? I know there used to be some interesting cases of classloading when trying to add custom UDFs. Not sure what the current state is.

Kevin Risden


On Tue, Mar 5, 2019 at 4:46 PM Shawn Weeks <sw...@weeksconsulting.us>> wrote:
Didn't here anything on the dev mailing list, has anyone here seen this scenario. Custom Hive Function starts throwing class not found errors but only after a while, the function runs fine most of the time and only has a single dependency.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us>>
Sent: Monday, March 4, 2019 1:17 PM
To: dev@hive.apache.org<ma...@hive.apache.org>
Subject: Custom UDF Loses Depenencies

Are there any known gotchas with Hive UDFs that included shaded dependencies in their jar. I've got an issue where I've built a an xml udtf based on Saxon HE and after some period of time the hive server starts raising this exception. The function is created using the permanent function syntax referencing a jar in HDFS. The jar works initially and then goes to failing after the instance has been up for a few days. I've verified that the jar the function uses has these classes in there.

I'm on Hive 1.2.1 with HDP 2.6.5 patches

Thanks
Shawn Weeks

2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for /cliservice
java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
        at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
        at net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
        at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
        at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
        at net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
        at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
        at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
        at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
        at xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
        at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
        at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
        at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
        at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
        at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
        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:206)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

RE: FW: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
I suspect it’s related to that. HIVE-11878 was for several of those issues but it’s included in my build. The function has worked fine for months in some environments and if we restart Hiveserver2 it will go back to working. I suspect it has to do with how jar shading works but I didn’t want to pollute the class path.

Thanks

Thanks
Shawn

From: Kevin Risden <kr...@apache.org>
Sent: Tuesday, March 5, 2019 3:49 PM
To: user@hive.apache.org
Subject: Re: FW: Custom UDF Loses Depenencies

Different classloader potentially inside HS2? I know there used to be some interesting cases of classloading when trying to add custom UDFs. Not sure what the current state is.

Kevin Risden


On Tue, Mar 5, 2019 at 4:46 PM Shawn Weeks <sw...@weeksconsulting.us>> wrote:
Didn't here anything on the dev mailing list, has anyone here seen this scenario. Custom Hive Function starts throwing class not found errors but only after a while, the function runs fine most of the time and only has a single dependency.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us>>
Sent: Monday, March 4, 2019 1:17 PM
To: dev@hive.apache.org<ma...@hive.apache.org>
Subject: Custom UDF Loses Depenencies

Are there any known gotchas with Hive UDFs that included shaded dependencies in their jar. I've got an issue where I've built a an xml udtf based on Saxon HE and after some period of time the hive server starts raising this exception. The function is created using the permanent function syntax referencing a jar in HDFS. The jar works initially and then goes to failing after the instance has been up for a few days. I've verified that the jar the function uses has these classes in there.

I'm on Hive 1.2.1 with HDP 2.6.5 patches

Thanks
Shawn Weeks

2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for /cliservice
java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
        at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
        at net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
        at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
        at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
        at net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
        at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
        at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
        at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
        at xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
        at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
        at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
        at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
        at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
        at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
        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:206)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Re: FW: Custom UDF Loses Depenencies

Posted by Kevin Risden <kr...@apache.org>.
Different classloader potentially inside HS2? I know there used to be some
interesting cases of classloading when trying to add custom UDFs. Not sure
what the current state is.

Kevin Risden


On Tue, Mar 5, 2019 at 4:46 PM Shawn Weeks <sw...@weeksconsulting.us>
wrote:

> Didn't here anything on the dev mailing list, has anyone here seen this
> scenario. Custom Hive Function starts throwing class not found errors but
> only after a while, the function runs fine most of the time and only has a
> single dependency.
>
> Thanks
> Shawn
>
> -----Original Message-----
> From: Shawn Weeks <sw...@weeksconsulting.us>
> Sent: Monday, March 4, 2019 1:17 PM
> To: dev@hive.apache.org
> Subject: Custom UDF Loses Depenencies
>
> Are there any known gotchas with Hive UDFs that included shaded
> dependencies in their jar. I've got an issue where I've built a an xml udtf
> based on Saxon HE and after some period of time the hive server starts
> raising this exception. The function is created using the permanent
> function syntax referencing a jar in HDFS. The jar works initially and then
> goes to failing after the instance has been up for a few days. I've
> verified that the jar the function uses has these classes in there.
>
> I'm on Hive 1.2.1 with HDP 2.6.5 patches
>
> Thanks
> Shawn Weeks
>
> 2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool:
> Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) -
> Error for /cliservice
> java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
>         at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
>         at
> net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
>         at
> net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
>         at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
>         at
> net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
>         at
> net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
>         at
> net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
>         at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
>         at
> xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
>         at
> org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
>         at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
>         at
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
>         at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
>         at
> org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
>         at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
>         at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
>         at
> org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
>         at
> org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
>         at
> org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
>         at
> org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
>         at
> org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
>         at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
>         at
> org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
>         at
> org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
>         at
> org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
>         at
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
>         at
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
>         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:206)
>         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:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
>

FW: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
Didn't here anything on the dev mailing list, has anyone here seen this scenario. Custom Hive Function starts throwing class not found errors but only after a while, the function runs fine most of the time and only has a single dependency.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Monday, March 4, 2019 1:17 PM
To: dev@hive.apache.org
Subject: Custom UDF Loses Depenencies

Are there any known gotchas with Hive UDFs that included shaded dependencies in their jar. I've got an issue where I've built a an xml udtf based on Saxon HE and after some period of time the hive server starts raising this exception. The function is created using the permanent function syntax referencing a jar in HDFS. The jar works initially and then goes to failing after the instance has been up for a few days. I've verified that the jar the function uses has these classes in there.

I'm on Hive 1.2.1 with HDP 2.6.5 patches

Thanks
Shawn Weeks

2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for /cliservice
java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
        at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
        at net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
        at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
        at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
        at net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
        at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
        at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
        at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
        at xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
        at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
        at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
        at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
        at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
        at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
        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:206)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

RE: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
I've finally hit a road block that I can't figure out a way around. There is a call to ReflectionUtils in HiveUtils. getAuthorizerFactory that is changing the current threads class loader to one for a completely different thread. I can make SessionState set it back but I have no idea why it's changing it. I'm guessing something in Java internals. Whatever's going on it completely breaks udf class loading in certain scenarios.

Thanks

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Sunday, March 10, 2019 12:42 PM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

This rabbit hole is getting a little crazy. I can see SessionState start and attach being called and can see that at those points the current thread class loader and session state class loader are the same but when add_resources is called they are not the same. The current thread class loader for add resources is the first class loader created for the first session state and never changes.

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 11:01 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

Ok nevermind, I see where the session state is being attached and the thread context is being switched. So the real question is why is the thread context class loader for registerJars different than the session state it was called with. Currently trying to find out what calls registerJars.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:57 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

The more I look at this the more confusing it gets, it looks like some places Hive is using the class loader from the SessionState.getConf() and sometimes from the thread context. I'd expect the thread context class loader and the session state one to be the same as the thread context is set by sessionstate. However I'm looking at the start method on SessionState and it doesn't set the classloader at all so registerJars may be getting the wrong class loader.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:44 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

I filed HIVE-21409 for this issue. It looks like the registerJars method in SessionState is still using the thread context class loader instead of grabbing the one from SessionState. I'm not sure how it happens but it looks like if you have a bunch of parallel sessions from something like Oozie right after Hive starts the class path can get really polluted quickly. I need to go look at the mechanism behind the "delete jars" command as running that on a brand new session seems to wipe all the extra stuff out of the class loader.

Thanks

-----Original Message-----
From: Gopal Vijayaraghavan <go...@apache.org> 
Sent: Wednesday, March 6, 2019 3:01 PM
To: dev@hive.apache.org
Subject: Re: Custom UDF Loses Depenencies

>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



RE: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
This rabbit hole is getting a little crazy. I can see SessionState start and attach being called and can see that at those points the current thread class loader and session state class loader are the same but when add_resources is called they are not the same. The current thread class loader for add resources is the first class loader created for the first session state and never changes.

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 11:01 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

Ok nevermind, I see where the session state is being attached and the thread context is being switched. So the real question is why is the thread context class loader for registerJars different than the session state it was called with. Currently trying to find out what calls registerJars.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:57 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

The more I look at this the more confusing it gets, it looks like some places Hive is using the class loader from the SessionState.getConf() and sometimes from the thread context. I'd expect the thread context class loader and the session state one to be the same as the thread context is set by sessionstate. However I'm looking at the start method on SessionState and it doesn't set the classloader at all so registerJars may be getting the wrong class loader.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:44 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

I filed HIVE-21409 for this issue. It looks like the registerJars method in SessionState is still using the thread context class loader instead of grabbing the one from SessionState. I'm not sure how it happens but it looks like if you have a bunch of parallel sessions from something like Oozie right after Hive starts the class path can get really polluted quickly. I need to go look at the mechanism behind the "delete jars" command as running that on a brand new session seems to wipe all the extra stuff out of the class loader.

Thanks

-----Original Message-----
From: Gopal Vijayaraghavan <go...@apache.org> 
Sent: Wednesday, March 6, 2019 3:01 PM
To: dev@hive.apache.org
Subject: Re: Custom UDF Loses Depenencies

>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



RE: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
Ok nevermind, I see where the session state is being attached and the thread context is being switched. So the real question is why is the thread context class loader for registerJars different than the session state it was called with. Currently trying to find out what calls registerJars.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:57 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

The more I look at this the more confusing it gets, it looks like some places Hive is using the class loader from the SessionState.getConf() and sometimes from the thread context. I'd expect the thread context class loader and the session state one to be the same as the thread context is set by sessionstate. However I'm looking at the start method on SessionState and it doesn't set the classloader at all so registerJars may be getting the wrong class loader.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:44 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

I filed HIVE-21409 for this issue. It looks like the registerJars method in SessionState is still using the thread context class loader instead of grabbing the one from SessionState. I'm not sure how it happens but it looks like if you have a bunch of parallel sessions from something like Oozie right after Hive starts the class path can get really polluted quickly. I need to go look at the mechanism behind the "delete jars" command as running that on a brand new session seems to wipe all the extra stuff out of the class loader.

Thanks

-----Original Message-----
From: Gopal Vijayaraghavan <go...@apache.org> 
Sent: Wednesday, March 6, 2019 3:01 PM
To: dev@hive.apache.org
Subject: Re: Custom UDF Loses Depenencies

>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



RE: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
The more I look at this the more confusing it gets, it looks like some places Hive is using the class loader from the SessionState.getConf() and sometimes from the thread context. I'd expect the thread context class loader and the session state one to be the same as the thread context is set by sessionstate. However I'm looking at the start method on SessionState and it doesn't set the classloader at all so registerJars may be getting the wrong class loader.

Thanks
Shawn

-----Original Message-----
From: Shawn Weeks <sw...@weeksconsulting.us> 
Sent: Saturday, March 9, 2019 10:44 AM
To: dev@hive.apache.org
Subject: RE: Custom UDF Loses Depenencies

I filed HIVE-21409 for this issue. It looks like the registerJars method in SessionState is still using the thread context class loader instead of grabbing the one from SessionState. I'm not sure how it happens but it looks like if you have a bunch of parallel sessions from something like Oozie right after Hive starts the class path can get really polluted quickly. I need to go look at the mechanism behind the "delete jars" command as running that on a brand new session seems to wipe all the extra stuff out of the class loader.

Thanks

-----Original Message-----
From: Gopal Vijayaraghavan <go...@apache.org> 
Sent: Wednesday, March 6, 2019 3:01 PM
To: dev@hive.apache.org
Subject: Re: Custom UDF Loses Depenencies

>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



RE: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
I filed HIVE-21409 for this issue. It looks like the registerJars method in SessionState is still using the thread context class loader instead of grabbing the one from SessionState. I'm not sure how it happens but it looks like if you have a bunch of parallel sessions from something like Oozie right after Hive starts the class path can get really polluted quickly. I need to go look at the mechanism behind the "delete jars" command as running that on a brand new session seems to wipe all the extra stuff out of the class loader.

Thanks

-----Original Message-----
From: Gopal Vijayaraghavan <go...@apache.org> 
Sent: Wednesday, March 6, 2019 3:01 PM
To: dev@hive.apache.org
Subject: Re: Custom UDF Loses Depenencies

>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



Re: Custom UDF Loses Depenencies

Posted by Gopal Vijayaraghavan <go...@apache.org>.
>    When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...

That looks like the root-cause of a different class of issues.

Since the fresh classloader is picking up the URLs, the URLs keep growing.

Worse, the Hadoop classes loaded from shims are coming off the thread loader & being reloaded a million times.

Cheers,
Gopal
 



Re: Custom UDF Loses Depenencies

Posted by Shawn Weeks <sw...@weeksconsulting.us>.
This kinda sounds like https://issues.apache.org/jira/browse/HIVE-11878 but I've confirmed it's included in the build I'm using.
[HIVE-11878] ClassNotFoundException can possibly occur if multiple jars are registered one at a time in Hive - ASF JIRA - issues.apache.org<https://issues.apache.org/jira/browse/HIVE-11878>
When we register a jar on the Hive console. Hive creates a fresh URL classloader which includes the path of the current jar to be registered and all the jar paths of the parent classloader. The parent classlaoder is the current ThreadContextClassLoader. Once the URLClassloader is created Hive sets ...
issues.apache.org


________________________________
From: Shawn Weeks
Sent: Monday, March 4, 2019 1:16 PM
To: dev@hive.apache.org
Subject: Custom UDF Loses Depenencies

Are there any known gotchas with Hive UDFs that included shaded dependencies in their jar. I've got an issue where I've built a an xml udtf based on Saxon HE and after some period of time the hive server starts raising this exception. The function is created using the permanent function syntax referencing a jar in HDFS. The jar works initially and then goes to failing after the instance has been up for a few days. I've verified that the jar the function uses has these classes in there.

I'm on Hive 1.2.1 with HDP 2.6.5 patches

Thanks
Shawn Weeks

2019-03-04 19:13:31,175 WARN  [HiveServer2-HttpHandler-Pool: Thread-70490]: servlet.ServletHandler (ServletHandler.java:doHandle(571)) - Error for /cliservice
java.lang.NoClassDefFoundError: net/sf/saxon/pattern/NodeTest$2
        at net.sf.saxon.pattern.NodeTest.getContentType(NodeTest.java:243)
        at net.sf.saxon.expr.AxisExpression.checkPlausibility(AxisExpression.java:292)
        at net.sf.saxon.expr.AxisExpression.typeCheck(AxisExpression.java:152)
        at net.sf.saxon.expr.Operand.typeCheck(Operand.java:185)
        at net.sf.saxon.expr.RawSlashExpression.typeCheck(RawSlashExpression.java:178)
        at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:141)
        at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:514)
        at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:489)
        at xxx.xxx.xxxGenericUDTFXPathExplode.initialize(GenericUDTFXPathExplode.java:84)
        at org.apache.hadoop.hive.ql.udf.generic.GenericUDTF.initialize(GenericUDTF.java:56)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genUDTFPlan(SemanticAnalyzer.java:7037)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genSelectPlan(SemanticAnalyzer.java:3986)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlan(SemanticAnalyzer.java:10077)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genLateralViewPlans(SemanticAnalyzer.java:10021)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9876)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9782)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9809)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9795)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10471)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:342)
        at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10485)
        at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:219)
        at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:474)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:330)
        at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1233)
        at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1227)
        at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
        at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:228)
        at org.apache.hive.service.cli.operation.Operation.run(Operation.java:264)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:479)
        at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:466)
        at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:315)
        at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:509)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1377)
        at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1362)
        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:206)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)