-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception
#44327
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
Conversation
| checkVersion(tmpDb, version, mapper); | ||
| try { | ||
| checkVersion(tmpDb, version, mapper); | ||
| } catch (IOException ioe) { |
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.
spark/common/network-common/src/main/java/org/apache/spark/network/util/LevelDBProvider.java
Lines 110 to 111 in 83434af
| public static void checkVersion(DB db, StoreVersion newversion, ObjectMapper mapper) throws | |
| IOException { |
For LevelDB, it will only throw IOException.
| throw new IOException(e.getMessage(), e); | ||
| } catch (IOException ioe) { | ||
| tmpDb.close(); | ||
| throw ioe; |
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.
spark/common/network-common/src/main/java/org/apache/spark/network/util/RocksDBProvider.java
Lines 151 to 152 in 83434af
| public static void checkVersion(RocksDB db, StoreVersion newversion, ObjectMapper mapper) throws | |
| IOException, RocksDBException { |
For RocksDB, it may throw either RocksDBException or IOException
|
friendly ping @dongjoon-hyun Could you help to review this if you have time, thanks ~ |
dongjoon-hyun
left a comment
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.
+1, looks fine to me.
Sorry for the late reply, @LuciferYang .
|
Merged to master. |
|
Thanks @dongjoon-hyun ~ |
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <[email protected]> Signed-off-by: mingji <[email protected]>
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <[email protected]> Signed-off-by: mingji <[email protected]>
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <[email protected]> Signed-off-by: mingji <[email protected]>
What changes were proposed in this pull request?
In the process of initializing the
DBinRocksDBProvider/LevelDBProvider, there is acheckVersionstep that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already openedRockDB/LevelDBinstance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes theRocksDB/LevelDBinstance whencheckVersionthrows an exception.Why are the changes needed?
Should close the
RocksDB/LevelDBinstance whencheckVersionthrow ExceptionDoes this PR introduce any user-facing change?
No
How was this patch tested?
Pass GitHub Actions
Was this patch authored or co-authored using generative AI tooling?
No