mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

FileChannel not closed after DBException.FileLocked exception is thrown

Open gavocanov opened this issue 7 years ago • 2 comments

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);
            }

gavocanov avatar Feb 23 '18 15:02 gavocanov

Is there any fix planned?

novoj avatar May 30 '19 08:05 novoj

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.

novoj avatar May 30 '19 08:05 novoj