fusesource / leveldbjni

A Java Native Interface to LevelDB
BSD 3-Clause "New" or "Revised" License
536 stars 143 forks source link

SIGSEGV when creating iterator after DB was closed #27

Closed gladwig closed 11 years ago

gladwig commented 11 years ago
DB db = JniDBFactory.factory.open(new File("test/jnitest"), options);
db.close();
db.iterator();

I am well aware that this is obviously wrong ;) However, this code results in the JVM core dumping:

SIGSEGV (0xb) at pc=0x0000000176d29df6, pid=7051, tid=4867

JRE version: 7.0_17-b02 Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode bsd-amd64 compressed oops) Problematic frame: C [libleveldbjni-64-1.6.jnilib+0x1df6] Java_org_fusesource_leveldbjni_internal_NativeDB_00024DBJNI_NewIterator+0x36

I'd rather get an exception telling me that I tried to access the DB object after it was closed. JVM errors are very hard to track down and it took some time until I was able to find the source of the problem.

chirino commented 11 years ago

Fixed.