[ https://issues.apache.org/jira/browse/HIVE-22393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Burgess updated HIVE-22393: -------------------------------- Status: Patch Available (was: In Progress) > HiveStreamingConnection: Exception in beginTransaction causes > AbstractRecordWriter to throw NPE, covering up real exception > --------------------------------------------------------------------------------------------------------------------------- > > Key: HIVE-22393 > URL: https://issues.apache.org/jira/browse/HIVE-22393 > Project: Hive > Issue Type: Bug > Components: Streaming > Affects Versions: 3.1.2 > Reporter: Alex Parrill > Assignee: Matt Burgess > Priority: Major > Attachments: HIVE-22393.1.patch > > > Getting an error in my code that does some basic stuff with > {{HiveStreamingConnection}}: > {code} > 19/10/23 15:12:44 ERROR yarn_logger.Main: Thread worker-0 uncaught exception > java.lang.RuntimeException: org.apache.hive.streaming.StreamingException: > Unable to close > at com.datto.yarn_logger.WorkerThread.run(WorkerThread.java:51) > Caused by: org.apache.hive.streaming.StreamingException: Unable to close > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.close(HiveStreamingConnection.java:973) > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.markDead(HiveStreamingConnection.java:833) > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.<init>(HiveStreamingConnection.java:677) > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.<init>(HiveStreamingConnection.java:596) > at > org.apache.hive.streaming.HiveStreamingConnection.createNewTransactionBatch(HiveStreamingConnection.java:485) > at > org.apache.hive.streaming.HiveStreamingConnection.beginNextTransaction(HiveStreamingConnection.java:466) > at > org.apache.hive.streaming.HiveStreamingConnection.beginTransaction(HiveStreamingConnection.java:507) > at com.datto.yarn_logger.WorkerThread.run(WorkerThread.java:49) > Caused by: java.lang.NullPointerException > at > org.apache.hive.streaming.AbstractRecordWriter.logStats(AbstractRecordWriter.java:547) > at > org.apache.hive.streaming.AbstractRecordWriter.close(AbstractRecordWriter.java:352) > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.closeImpl(HiveStreamingConnection.java:979) > at > org.apache.hive.streaming.HiveStreamingConnection$TransactionBatch.close(HiveStreamingConnection.java:970) > ... 7 more > {code} > Digging through the stack trace... {{TransactionBatch}} will try to catch > exception in its constructor, and calls the close method if an exception is > thrown (which is definitely happening; that's line 677 in > {{HiveStreamingConnection.java}}). This eventually calls > {{AbstractRecordWriter::close}} which, calls {{logStats}}, which tries to use > {{heapMemoryMonitor}}, which is null because presumably {{init}} had never > been called on the writer yet. > Easy fix would to just check in {{logStats}} if {{heapMemoryMonitor}} is > null, and do the same thing if the method it calls returns null in it. -- This message was sent by Atlassian Jira (v8.3.4#803005)