On 2015-08-28 14:01, Robert Munteanu wrote:
Hi,

I'm looking at LastRevRecoveryAgentTest [1] which uses a shared
document store for two DocumentNodeStore instances. Disposing both node
store instances makes the tests fail, as the document store will be
closed by the first call to dispose() and the second call will fail.

The reason is the following snippet in DocumentNodeStore.dispose() (
full context at [2] ) :

         internalRunBackgroundUpdateOperations();
        
        // other stuff

         store.dispose();

If we have two node stores being shutdown, one of them will call
store.dispose() before the other is able to run its
backgroundUpdateOperations(). For the RDB and Mongo stores, the
connection will be closed.

Also of interest - the LastRecoveryTest[3] , which has a similar setup,
only uses a shared MemoryDocumentStore and does not have this problem.

I don't think this behaviour exists only in tests, so I'd be interested
to see if there's a solution to this. The only idea that I have is the
DocumentStore instances knowing how many 'users' it has and only
accepting to be disposed when the last 'user' is gone, but that
requires that all 'users' obey this contract.

Thoughts?

Thanks,

Robert

My understanding is that instances can not be shared, thus this is a bug in the test cases.

Best regards, Julian

Reply via email to