-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-22793][SQL]Memory leak in Spark Thrift Server #20029
Conversation
This indeed is the primary change as it's open vs master. #19989 had some concerns about whether this affects correctness though? |
Thanks @srowen , so whom could i ping to make sure this change has no side effects? |
I'm asking you to respond to #19989 (comment) |
Can you check the GC root and explain why they are increasing? The fix looks not correct to me as we should create new session. |
It seems each time when connect to thrift server through beeline, the |
Is it necessary to create a new HiveClient here since there has a hiveClient in externalCatalog already? |
cc @liufengdb |
Could you please to check this PR? Thanks @liufengdb |
What it seems is never closed by your analysis is the client used to interact with the metastore. This might be a problem which we are not aware of in normal SQL applications, since we have only one client in those cases. What you are doing in your fix is avoiding creating a client for each
Please let me know if I misunderstood or I was wrong with something. |
@zuotingbing I took a close look at the related code and thought the issue you raised is valid:
|
@liufengdb does it mean that we are creating more than one SparkSession in the thriftserver? |
By this line, yes. |
lgtm! |
ok to test |
Shouldn't Although looks like in |
Test build #85736 has finished for PR 20029 at commit
|
|
# What changes were proposed in this pull request? 1. Start HiveThriftServer2. 2. Connect to thriftserver through beeline. 3. Close the beeline. 4. repeat step2 and step 3 for many times. we found there are many directories never be dropped under the path `hive.exec.local.scratchdir` and `hive.exec.scratchdir`, as we know the scratchdir has been added to deleteOnExit when it be created. So it means that the cache size of FileSystem `deleteOnExit` will keep increasing until JVM terminated. In addition, we use `jmap -histo:live [PID]` to printout the size of objects in HiveThriftServer2 Process, we can find the object `org.apache.spark.sql.hive.client.HiveClientImpl` and `org.apache.hadoop.hive.ql.session.SessionState` keep increasing even though we closed all the beeline connections, which may caused the leak of Memory. # How was this patch tested? manual tests This PR follw-up the #19989 Author: zuotingbing <[email protected]> Closes #20029 from zuotingbing/SPARK-22793. (cherry picked from commit be9a804) Signed-off-by: gatorsmile <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also LGTM
Thanks! Merged to master/2.3
# What changes were proposed in this pull request? 1. Start HiveThriftServer2. 2. Connect to thriftserver through beeline. 3. Close the beeline. 4. repeat step2 and step 3 for many times. we found there are many directories never be dropped under the path `hive.exec.local.scratchdir` and `hive.exec.scratchdir`, as we know the scratchdir has been added to deleteOnExit when it be created. So it means that the cache size of FileSystem `deleteOnExit` will keep increasing until JVM terminated. In addition, we use `jmap -histo:live [PID]` to printout the size of objects in HiveThriftServer2 Process, we can find the object `org.apache.spark.sql.hive.client.HiveClientImpl` and `org.apache.hadoop.hive.ql.session.SessionState` keep increasing even though we closed all the beeline connections, which may caused the leak of Memory. # How was this patch tested? manual tests This PR follw-up the apache#19989 Author: zuotingbing <[email protected]> Closes apache#20029 from zuotingbing/SPARK-22793. (cherry picked from commit be9a804)
What changes were proposed in this pull request?
we found there are many directories never be dropped under the path
hive.exec.local.scratchdir
andhive.exec.scratchdir
, as we know the scratchdir has been added to deleteOnExit when it be created. So it means that the cache size of FileSystemdeleteOnExit
will keep increasing until JVM terminated.In addition, we use
jmap -histo:live [PID]
to printout the size of objects in HiveThriftServer2 Process, we can find the object
org.apache.spark.sql.hive.client.HiveClientImpl
andorg.apache.hadoop.hive.ql.session.SessionState
keep increasing even though we closed all the beeline connections, which may caused the leak of Memory.How was this patch tested?
manual tests
This PR follw-up the #19989