Skip to content

Commit

Permalink
Stop bitcask_file after failure to open file
Browse files Browse the repository at this point in the history
This fixes a process leak and logs the file open failure.
  • Loading branch information
ian-mi authored and Doug Rohrer committed Jan 28, 2016
1 parent f5317be commit a35d6d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bitcask_file.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ handle_call({file_open, Owner, Filename, Opts}, _From, State) ->
{ok, Fd} ->
State2 = State#state{fd=Fd, owner=Owner},
{reply, ok, State2};
Error ->
{reply, Error, State}
Error = {error, Reason} ->
error_logger:error_msg("Failed to open file ~p: ~p~n",
[Filename, Reason]),
{stop, {file_open_failed, Reason}, Error, State}
end;
handle_call(file_close, From, State=#state{fd=Fd}) ->
check_owner(From, State),
Expand Down

5 comments on commit a35d6d6

@borshop
Copy link
Contributor

@borshop borshop commented on a35d6d6 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from mrallen1
at a35d6d6

@borshop
Copy link
Contributor

@borshop borshop commented on a35d6d6 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/bitcask/im/bugfix/bitcask-file-process-leak = a35d6d6 into borshop-integration-229-im/bugfix/bitcask-file-process-leak

@borshop
Copy link
Contributor

@borshop borshop commented on a35d6d6 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/bitcask/im/bugfix/bitcask-file-process-leak = a35d6d6 merged ok, testing candidate = 9fbd9b4

@borshop
Copy link
Contributor

@borshop borshop commented on a35d6d6 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

@borshop borshop commented on a35d6d6 Feb 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding 1.7 to borshop-integration-229-im/bugfix/bitcask-file-process-leak = 9fbd9b4

Please sign in to comment.