Wellington Chevreuil created HBASE-30577:
--------------------------------------------

             Summary: Spark 4 HBaseDataWriter and HBasePartitionReader leak or 
double-release cached HBase connections.
                 Key: HBASE-30577
                 URL: https://issues.apache.org/jira/browse/HBASE-30577
             Project: HBase
          Issue Type: Sub-task
            Reporter: Wellington Chevreuil
            Assignee: Wellington Chevreuil


HBaseDataWriter gets a SmartConnection from HBaseConnectionCache in its 
constructor, before it validates the schema and calls getTable. Spark's 
DataWritingSparkTask calls createWriter outside its try block, so if the 
constructor throws exception, there is no reference count release.

Also, commit() and abort() methods both close the table and the connection. 
When a flush fails inside commit(), Spark calls abort() next, so the reference 
count is decremented twice. The connection is shared by all tasks in the 
executor, and housekeeping can evict it and close it while other writers or 
readers are still using it. Neither method uses try/finally either, so a 
table.close() failure skips connection.close(). 

On the read path, DataSourceRDD creates the reader before it registers the task 
listener that calls close(). So if the reader's constructor throws exception, 
nothing releases what it already opened. 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to