LuciferYang commented on PR #36403:
URL: https://github.com/apache/spark/pull/36403#issuecomment-1114921698

   > Change `WeakReference` in `iteratorTracker` to strong reference should 
avoid the issue I mentioned above, all `LevelDB/RockDBIterator` not explicitly 
closed in Spark code will be closed in `close` method of 
`LevelDB/RocksDB`(after 
[SPARK-38896](https://issues.apache.org/jira/browse/SPARK-38896) is merged, all 
`LevelDB/RockDBIterator` should have been explicitly closed in Spark code). The 
side effect of the above change is that `iteratorTracker` will no longer be 
affected by GC behavior.
   > 
   > If the above changes are made, 'finalize()' is no longer meaningful 
because the a `LevelDB/RockDBIterator` instances entering the `Finalization ` 
process have already called the close method.
   
   Think more about it. If there are too many `LevelDB/RocksDBIterator` are not 
explicitly closed in Spark code, there will be too many objects in 
`iteratorTracker` and they cannot be GC, this is a risk. It seems that the 
precondition for this change should be that almost all 
`LevelDB/RocksDBIterator` will be explicitly closed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to