jankotek / mapdb

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.
https://mapdb.org
Apache License 2.0
4.89k stars 873 forks source link

Fix race between close() and get() in StoreDirect #969

Open aleksandrserbin opened 4 years ago

aleksandrserbin commented 4 years ago

There is a race, when Store is closed, but there are still iterators somewhere, which may use it. In the concurrent environment, get() call can pass assertNotClosed assertion, but acquire the lock after Store::close completed.

Probably linked to https://github.com/jankotek/mapdb/issues/892 as well, if there is a scenario with concurrent close and get.

Note: this will still lead to exception, however it will be an IllegalAccessError, rather then NullPointerException