Bitcask should not call application:start(bitcask) when opening a cask #40

Closed
dreverri opened this Issue Mar 16, 2012 · 2 comments

4 participants

@dreverri

Bitcask calls application:start(bitcask) every time bitcask:open/1,2 is called:
https://github.com/basho/bitcask/blob/master/src/bitcask.erl#L92
https://github.com/basho/bitcask/blob/master/src/bitcask.erl#L714

The responsibility for loading/starting the bitcask application should lie with the application which is using bitcask.

The current implementation can cause problems for applications, such as Riak, that open casks without blocking the main application's start up. For example, in Riak, the call to application:start(bitcask) within a vnode can deadlock with init:stop(). When processing init:stop() the application controller will wait for vnodes to shutdown. If the vnodes are still starting when init:stop() is called they will block on the call to application:start(bitcask). The deadlock eventually times out, after 5 minutes, and the application controller can complete the shutdown of Riak.

Steps to reproduce:
1. Run riak start; riak stop
2. Repeat step 1 until riak stop hangs for about 5 minutes

@dizzyd

Agreed. That call to start_app should just validate that the app has been started and return {error, {not_started, bitcask}} if not.

@metadave metadave was assigned May 17, 2012
@slfritchie

I'm going to close this one: Bitcask now has a supervisor and worker processes under that supervisor that are required for Bitcask operation.

@slfritchie slfritchie closed this Mar 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment