1

Closed

RaptorDB.Shutdown() occasionally throws System.ObjectDisposedException

description

On the 2.6 and 2.7.5 releases RaptorDB.Shutdown() occasionally throws System.ObjectDisposedException:

----> System.ObjectDisposedException
Message
Cannot access a closed file.
Stack
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Flush()
at RaptorDB.FileLogger.WriteData()
at RaptorDB.FileLogger.ShutDown()
at RaptorDB.KeyStore`1.Shutdown()
Test case:
  • In a continuous loop do the following (I used a test console):

    o new up a RaptorDB<string>
    o insert several thousand randomly generated key/value pairs
    o Read random keys for about 2 seconds
    o Call RaptorDB<string>.Shutdown()
  • About every 5th loop RaptorDB throws a System.ObjectDisposedException
Closed Jan 24, 2015 at 7:06 AM by MGholam
Should be fixed in the latest version.

comments

MGholam wrote Mar 7, 2014 at 7:17 AM

The problem seems to be with the log file which is singleton (this could happen if you are running in nunit for example since it keeps the instance alive after test completion).

I will look into it and post a fix.

Thanks.