You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/06/16 18:36:52 UTC
[couchdb] branch jenkins-pipeline updated: Save IO logs even if
exit reason is
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 <va...@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" <co...@couchdb.apache.org>'].