basho / eleveldb

Erlang LevelDB API
262 stars 177 forks source link

avoid badarg exception when closing db_refs being closed #113

Closed vinoski closed 10 years ago

vinoski commented 10 years ago

DbObject::RetrieveDbObject() returns NULL for 2 cases: when the db_ref NIF resource can't be retrieved, and when the "close requested" flag is already set. But eleveldb_close() treats both NULL return cases as an error and raises the badarg exception for both.

Modify DbObject::RetrieveDbObject() to add a defaulted third argument, a pointer to bool that defaults to NULL. If non-NULL, DbObject::RetrieveDbObject() sets the bool to true if the db_ref NIF resource is successfully retrieved, false otherwise. This allows eleveldb_close() to pass that bool argument and then use it to distinguish between the two NULL return cases from DbObject::RetrieveDbObject().

reiddraper commented 10 years ago

+1. I've run eleveldb eunit/eqc 5 times now with no problems. I've run KV once (and offline @vinoski mentioned he ran it overnight). I'll continue running KV eunit to be safe. But let's go ahead and merge.

reiddraper commented 10 years ago

The merge-commit test failed. @vinoski and I are looking into it. It's failing with process killed by signal 11.

reiddraper commented 10 years ago

I forced a rebuild and the test still failed.