Skip to content

Commit

Permalink
Explicitely close the file descriptor. It doesn't hurt.
Browse files Browse the repository at this point in the history
Also, since we open the file in 'raw' mode, I suspect the file descriptor is not closed when the couch_file server dies.

From erl -man file:

"The raw option allows faster access to a file, because no Erlang process is needed to handle the file."

For me, no Erlang process handling the file means that it's likely the file is not closed by any other process.




git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001196 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
fdmanana committed Sep 25, 2010
1 parent 64f1cad commit 0d173b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/couchdb/couch_file.erl
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ maybe_track_open_os_files(FileOptions) ->
couch_stats_collector:track_process_count({couchdb, open_os_files})
end.

terminate(_Reason, _Fd) ->
ok.
terminate(_Reason, #file{fd = Fd}) ->
ok = file:close(Fd).


handle_call({pread_iolist, Pos}, _From, File) ->
Expand Down

0 comments on commit 0d173b4

Please sign in to comment.