mapdb
mapdb copied to clipboard
FileChannel not closed after DBException.FileLocked exception is thrown
mapdb version: 3.0.5 using:
DBMaker
.fileDB(name)
.make()
This leads very fast to "too many open files" if using some sort of retry mechanism.
Modifying the code to just close the channel seems like fixing the issue but I'm not sure if there could be similar problems with other storage backends etc.
if (fileLockWait <= 0) {
try {
channel.close();
} catch (IOException e) { /*at least we tried */ }
throw new DBException.FileLocked(file.toPath(), null);
}
Is there any fix planned?
Seems there is similar problem in /opt/repository/org/mapdb/mapdb/3.0.7/mapdb-3.0.7-sources.jar!/org/mapdb/StoreWAL.kt:145 when detecting file corruption locks are not freed.
When I call volume.close() before exception is thrown locks the problem is solved.