couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] branch jenkins-pipeline updated: Save IO logs even if exit reason is
Date Fri, 16 Jun 2017 18:36:52 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch jenkins-pipeline
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/jenkins-pipeline by this push:
     new 1d347e9  Save IO logs even if exit reason is
1d347e9 is described below

commit 1d347e952941214e9fd3b08bb160bdb81e4f99c5
Author: Nick Vatamaniuc <vatamane@apache.org>
AuthorDate: Fri Jun 16 14:36:46 2017 -0400

    Save IO logs even if exit reason is
---
 src/couch/src/couch_io_logger.erl  | 9 ++++++---
 src/couch/src/couch_os_process.erl | 3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_io_logger.erl b/src/couch/src/couch_io_logger.erl
index 387b231..a8f44b7 100644
--- a/src/couch/src/couch_io_logger.erl
+++ b/src/couch/src/couch_io_logger.erl
@@ -87,7 +87,10 @@ log_name() ->
 
 close_logs() ->
     file:close(get(logger_out_fd)),
-    file:close(get(logger_in_fd)).
+    file:close(get(logger_in_fd)),
+    erase(logger_path),
+    erase(logger_out_fd),
+    erase(logger_in_fd).
 
 
 save_error_logs(Path, Err) ->
@@ -98,8 +101,8 @@ save_error_logs(Path, Err) ->
     OFd = get(logger_in_fd),
     file:position(IFd, 0),
     file:position(OFd, 0),
-    file:copy(IFd, Path ++  ".out.log"),
-    file:copy(OFd, Path ++ ".in.log"),
+    file:copy(IFd, Path ++  ".in.log"),
+    file:copy(OFd, Path ++ ".out.log"),
     couch_log:error("XXXXXXXXXXXXXXXXX saved error log ~p ~p", [Path, Err]).
 
 
diff --git a/src/couch/src/couch_os_process.erl b/src/couch/src/couch_os_process.erl
index fb1f142..4640b35 100644
--- a/src/couch/src/couch_os_process.erl
+++ b/src/couch/src/couch_os_process.erl
@@ -204,8 +204,10 @@ handle_call({prompt, Data}, _From, #os_proc{idle=Idle}=OsProc) ->
         throw:{error, OsError} ->
             {reply, OsError, OsProc, Idle};
         throw:{fatal, OsError} ->
+            couch_io_logger:stop_error(OsError),
             {stop, normal, OsError, OsProc};
         throw:OtherError ->
+            couch_io_logger:stop_error(OtherError),
             {stop, normal, OtherError, OsProc}
     after
         garbage_collect()
@@ -218,6 +220,7 @@ handle_cast({send, Data}, #os_proc{writer=Writer, idle=Idle}=OsProc) ->
     catch
         throw:OsError ->
             couch_log:error("Failed sending data: ~p -> ~p", [Data, OsError]),
+            couch_io_logger:stop_error(OsError),
             {stop, normal, OsProc}
     end;
 handle_cast(garbage_collect, #os_proc{idle=Idle}=OsProc) ->

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message