Reply
Highlighted
New Contributor
Posts: 2
Registered: ‎08-13-2018

Jdbc HS2 Driver queries fail after short period of inactivity

[ Edited ]

In my appilcation I connect to Hive w/ Kerberos and run multiple queries.  I am using Spring Boot with basic JDBCTemplate and basic datasources.

 

Each query can take between 1 minutes and 2 hours to process completely.

 

It seems that during longer processed queries any following queries start failing with table not found errors:

 

[Cloudera][JSQLEngine](12010) The table "myDatabase"."myTable" count not be found.

 

If I shorten my result sets so that the queries take only a small amount of time then all queries execute successfully.  When I expand them to take 30 minutes or longer the problem appears again.

 

This leads me to suspect the connection is going stale somehow and the HS2Driver is unaware the connection is dead and presenting the confusing error.  There is no hint of the connection having timed out or having closed.  if I force close the underlying connection then I get a different error about the connection being closed, rather than the confusing error about the table not being found.

 

The table, by the way, is really there and has not gone anywhere.  It can be queried via Hue or Beeline and relaunching my java application to refresh the data layer and the table is suddenly back.  It is only disappearing on the connection reuse.

 

While I am looking into Spring solutions to force disposable connections only used once, I thought I would ask here if there are any Cloudera HS2 Driver parameters that would help.


Thanks.

Cloudera Employee
Posts: 375
Registered: ‎03-23-2015

Re: Jdbc HS2 Driver queries fail after short period of inactivity

If it is connection issue, then error message should be different, not table not found error.

Can you share more client side error so that I can have more context?
New Contributor
Posts: 2
Registered: ‎08-13-2018

Re: Jdbc HS2 Driver queries fail after short period of inactivity

Thanks Eric,

I fixed my issue by changing the Spring datasource to DriverManagerDataSource which provides a new connection for each query.

I realize this is not necessarily a solution, but a work around, however it solves my immediate problem without too many side effects as I have no session/connection scoped state such as temporary functions to be concerned about.

This means that I am unable to provide more of the stack traces for you at the moment. Things move on.

Thanks for the help though.


Announcements