couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1001196 - /couchdb/trunk/src/couchdb/couch_file.erl
Date Sat, 25 Sep 2010 11:26:40 GMT
Author: fdmanana
Date: Sat Sep 25 11:26:39 2010
New Revision: 1001196

URL: http://svn.apache.org/viewvc?rev=1001196&view=rev
Log:
Explicitely close the file descriptor. It doesn't hurt.
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.



Modified:
    couchdb/trunk/src/couchdb/couch_file.erl

Modified: couchdb/trunk/src/couchdb/couch_file.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_file.erl?rev=1001196&r1=1001195&r2=1001196&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_file.erl (original)
+++ couchdb/trunk/src/couchdb/couch_file.erl Sat Sep 25 11:26:39 2010
@@ -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) ->



Mime
View raw message