Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIVY-987] NPE when waiting for thrift session to start timeout. #416

Closed
wants to merge 7 commits into from

Conversation

jianzhenwu
Copy link
Contributor

@jianzhenwu jianzhenwu commented Aug 25, 2023

What changes were proposed in this pull request?

Fix NPE when waiting for thrift session to start timeout.
https://issues.apache.org/jira/browse/LIVY-987

How was this patch tested?

manual tests by beeline and set timeout to 10s.

0: jdbc:hive2://username:password@thrift-server> select 123;

RSC client is executing SQL query: select 123, statementId = 681bc017-8f37-4665-a575-da355db77254, session = SessionHandle [c17f1729-6ee1-4260-b82b-aebec3b08e14]

Livy session has not yet started. Please wait for it to be ready...

Error: java.util.concurrent.TimeoutException: Futures timed out after [10000 milliseconds] (state=,code=0)

0: jdbc:hive2://username:password@thrift-server> Closing: 0: jdbc:hive2://username:password@thrift-server

Please review https://livy.incubator.apache.org/community/ before opening a pull request.

@jianzhenwu jianzhenwu self-assigned this Aug 25, 2023
@mgaido91
Copy link
Contributor

Can we add a UT to ensure that such problem will not appear again in the future?

@jianzhenwu
Copy link
Contributor Author

Can we add a UT to ensure that such problem will not appear again in the future?

thank you for your reply. Of course, please review again.

Comment on lines 48 to 49
private def createThriftSessionManager(maxSessionWait: Option[String],
limitTypes: ConnectionLimitType*): LivyThriftSessionManager = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great if we could create an overloaded method where we can pass the LivyConf. Might be useful in the future as well.

Btw, regarding style, it should be

  private def createThriftSessionManager(
      maxSessionWait: Option[String], limitTypes: ConnectionLimitType*): LivyThriftSessionManager = {

or

  private def createThriftSessionManager(
      maxSessionWait: Option[String],
      limitTypes: ConnectionLimitType*): LivyThriftSessionManager = {

if it is too long

}

@Test(expected = classOf[TimeoutException])
def testGetLivySessionWithTimeoutException(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this test check? What does it add to the test above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please provide an explanation here?

@@ -549,6 +549,11 @@ class LivyThriftSessionManager(val server: LivyThriftServer, val livyConf: LivyC
def getSessionInfo(sessionHandle: SessionHandle): SessionInfo = {
sessionInfo.get(sessionHandle)
}

private[thriftserver] def _mockLivySession(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we rather make sessionHandleToLivySession visible by private[thriftserver] so we can avoid adding this method only for testing? Why do you think this option is better?

@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2023

Codecov Report

Merging #416 (8c7970a) into master (5dccc47) will decrease coverage by 36.82%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##             master     #416       +/-   ##
=============================================
- Coverage     65.50%   28.68%   -36.82%     
+ Complexity      952      379      -573     
=============================================
  Files           103      103               
  Lines          6062     6062               
  Branches        916      916               
=============================================
- Hits           3971     1739     -2232     
- Misses         1542     3971     +2429     
+ Partials        549      352      -197     

see 87 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@mgaido91 mgaido91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, only a question and a minor style change

}

@Test(expected = classOf[TimeoutException])
def testGetLivySessionWithTimeoutException(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please provide an explanation here?

…r/TestLivyThriftSessionManager.scala

Co-authored-by: Marco Gaido <[email protected]>
@jianzhenwu
Copy link
Contributor Author

Looks good, only a question and a minor style change

My point is that this test is used to cover the case where Furetur#isCompleted is true.
image

This may be a bit redundant. If you suggest removing it, I can add a commit to this PR to remove it,

@mgaido91
Copy link
Contributor

mgaido91 commented Sep 4, 2023

LGTM

@mgaido91
Copy link
Contributor

mgaido91 commented Sep 4, 2023

I am having some problems to merge this as the current script requires Python2 while I have only python3 on my M1 OSX and installing python 2 is not easy. We should probably migrate the merge script to python3. I will try and do that in the next days, but if someone else wants to merge this, LGTM

@mgaido91 mgaido91 closed this in bf30e3b Sep 5, 2023
jimenefe pushed a commit to onedot-data/incubator-livy that referenced this pull request Oct 15, 2024
## What changes were proposed in this pull request?
Fix NPE when waiting for thrift session to start timeout.
https://issues.apache.org/jira/browse/LIVY-987

## How was this patch tested?
manual tests by beeline and set timeout to 10s.

0: jdbc:hive2://username:passwordthrift-server> select 123;

RSC client is executing SQL query: select 123, statementId = 681bc017-8f37-4665-a575-da355db77254, session = SessionHandle [c17f1729-6ee1-4260-b82b-aebec3b08e14]

Livy session has not yet started. Please wait for it to be ready...

Error: java.util.concurrent.TimeoutException: Futures timed out after [10000 milliseconds] (state=,code=0)

0: jdbc:hive2://username:passwordthrift-server> Closing: 0: jdbc:hive2://username:passwordthrift-server

Please review https://livy.incubator.apache.org/community/ before opening a pull request.

Author: jianzhen.wu <[email protected]>
Author: jianzhenwu <[email protected]>

Closes apache#416 from jianzhenwu/LIVY-987.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants