[ 
https://issues.apache.org/jira/browse/HIVE-20737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16648315#comment-16648315
 ] 

Denys Kuzmenko edited comment on HIVE-20737 at 10/13/18 8:51 AM:
-----------------------------------------------------------------

{code:java}
public void open(HiveConf conf) throws HiveException {
    closeLock.readLock().lock();
    try {  
        ...     
        hiveSparkClient = HiveSparkClientFactory.createHiveSparkClient(conf, 
sessionId,      
        ...
   }
{code}
Double-checked locking should be used, otherwise, it might happen, than inner 
logic of the "open" method will be attempted multiple times and initiate 
several SparkContexts within the same Spark session. LocalHiveSparkClient, "new 
SparkContext()" will throw exception "Only one SparkContext may be running in 
this JVM".

 


was (Author: dkuzmenko):
{{{code}}}

public void open(HiveConf conf) throws HiveException {
    closeLock.readLock().lock();
    try {  

   ...     

         hiveSparkClient = HiveSparkClientFactory.createHiveSparkClient(conf, 
sessionId,      

    ....

   }

{{{code}}}

Double-checked locking should be used, otherwise, it might happen, than inner 
logic of the "open" method will be attempted multiple times and initiate 
several SparkContexts within the same Spark session. LocalHiveSparkClient, "new 
SparkContext()" will throw exception "Only one SparkContext may be running in 
this JVM".

 

> LocalHiveSparkClient and SparkSession race condition fix
> --------------------------------------------------------
>
>                 Key: HIVE-20737
>                 URL: https://issues.apache.org/jira/browse/HIVE-20737
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>            Reporter: Denys Kuzmenko
>            Priority: Major
>         Attachments: HIVE-20737.1.patch
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to