diff --git a/src/comm/comm_client.cpp b/src/comm/comm_client.cpp index cf6e4a69..3dde5341 100644 --- a/src/comm/comm_client.cpp +++ b/src/comm/comm_client.cpp @@ -52,7 +52,7 @@ namespace comm { close(read_fd); close(write_fd); - + util::kill_process(pid, false); return -1; } @@ -63,7 +63,7 @@ namespace comm { // Websocat process. util::unmask_signal(); - + close(write_pipe[1]); //parent write close(read_pipe[0]); //parent read @@ -85,7 +85,7 @@ namespace comm NULL}; const int ret = execv(execv_args[0], execv_args); - LOG_ERROR << errno << ": websocat process execv failed."; + std::cerr << errno << ": websocat process execv failed.\n"; exit(1); } else diff --git a/src/comm/comm_server.cpp b/src/comm/comm_server.cpp index 5f85203c..36c90df3 100644 --- a/src/comm/comm_server.cpp +++ b/src/comm/comm_server.cpp @@ -335,7 +335,7 @@ namespace comm execv_args[idx] = NULL; const int ret = execv(execv_args[0], execv_args); - LOG_ERROR << errno << ": websocketd process execv failed."; + std::cerr << errno << ": websocketd process execv failed.\n"; exit(1); } else diff --git a/src/cons/cons.cpp b/src/cons/cons.cpp index ea650dd8..5da62c5e 100644 --- a/src/cons/cons.cpp +++ b/src/cons/cons.cpp @@ -280,14 +280,14 @@ namespace cons // only consider recent proposals and proposals from previous stage and current stage. const bool keep_candidate = (time_diff < (conf::cfg.roundtime * 4)) && (stage_diff == -3 || stage_diff <= 1); LOG_DEBUG << (keep_candidate ? "Prop--->" : "Erased") - << " [s" << std::to_string(cp.stage) - << "] u/i/o:" << cp.users.size() - << "/" << cp.hash_inputs.size() - << "/" << cp.hash_outputs.size() - << " ts:" << std::to_string(cp.time) - << " lcl:" << cp.lcl.substr(0, 15) - << " state:" << cp.state - << " [from:" << ((cp.pubkey == conf::cfg.pubkey) ? "self" : util::get_hex(cp.pubkey, 1, 5)) << "]"; + << " [s" << std::to_string(cp.stage) + << "] u/i/o:" << cp.users.size() + << "/" << cp.hash_inputs.size() + << "/" << cp.hash_outputs.size() + << " ts:" << std::to_string(cp.time) + << " lcl:" << cp.lcl.substr(0, 15) + << " state:" << cp.state + << " [from:" << ((cp.pubkey == conf::cfg.pubkey) ? "self" : util::get_hex(cp.pubkey, 1, 5)) << "]"; if (keep_candidate) ++itr; @@ -377,7 +377,7 @@ namespace cons p2p::broadcast_message(fbuf, true); LOG_DEBUG << "NUP sent." - << " users:" << nup.user_inputs.size(); + << " users:" << nup.user_inputs.size(); } /** @@ -524,7 +524,7 @@ namespace cons // before execution chdir into a valid the latest state data directory that contains an appbill.table chdir(conf::ctx.state_rw_dir.c_str()); int ret = execv(execv_args[0], execv_args); - LOG_ERROR << "Appbill process execv failed: " << ret; + std::cerr << errno << ": Appbill process execv failed.\n"; return false; } else @@ -667,11 +667,11 @@ namespace cons p2p::broadcast_message(fbuf, true); LOG_DEBUG << "Proposed u/i/o:" << p.users.size() - << "/" << p.hash_inputs.size() - << "/" << p.hash_outputs.size() - << " ts:" << std::to_string(p.time) - << " lcl:" << p.lcl.substr(0, 15) - << " state:" << p.state; + << "/" << p.hash_inputs.size() + << "/" << p.hash_outputs.size() + << " ts:" << std::to_string(p.time) + << " lcl:" << p.lcl.substr(0, 15) + << " state:" << p.state; } /** diff --git a/src/hpfs/hpfs.cpp b/src/hpfs/hpfs.cpp index 875b46fb..3e3b61af 100644 --- a/src/hpfs/hpfs.cpp +++ b/src/hpfs/hpfs.cpp @@ -67,7 +67,7 @@ namespace hpfs NULL}; const int ret = execv(execv_args[0], execv_args); - LOG_ERROR << errno << ": hpfs merge process execv failed."; + std::cerr << errno << ": hpfs merge process execv failed.\n"; exit(1); } else @@ -165,7 +165,7 @@ namespace hpfs NULL}; const int ret = execv(execv_args[0], execv_args); - LOG_ERROR << errno << ": hpfs session process execv failed."; + std::cerr << errno << ": hpfs session process execv failed.\n"; exit(1); } else diff --git a/src/sc.cpp b/src/sc.cpp index e53e046a..0c26c5f3 100644 --- a/src/sc.cpp +++ b/src/sc.cpp @@ -26,6 +26,9 @@ namespace sc } int ret = 0; + + LOG_DEBUG << "Starting contract process..." << (ctx.args.readonly ? " (rdonly)" : ""); + const pid_t pid = fork(); if (pid > 0) { @@ -74,8 +77,6 @@ namespace sc // Write the contract input message from HotPocket to the stdin (0) of the contract process. write_contract_args(ctx); - LOG_DEBUG << "Starting contract process..." << (ctx.args.readonly ? " (rdonly)" : ""); - const bool using_appbill = !ctx.args.readonly && !conf::cfg.appbill.empty(); int len = conf::cfg.runtime_binexec_args.size() + 1; if (using_appbill) @@ -97,7 +98,7 @@ namespace sc chdir(ctx.args.state_dir.c_str()); int ret = execv(execv_args[0], execv_args); - LOG_ERROR << errno << ": Contract process execv failed." << (ctx.args.readonly ? " (rdonly)" : ""); + std::cerr << errno << ": Contract process execv failed." << (ctx.args.readonly ? " (rdonly)" : "") << "\n"; exit(1); } else @@ -160,7 +161,7 @@ namespace sc return -1; LOG_DEBUG << "Stopping hpfs session... pid:" << ctx.hpfs_pid << (ctx.args.readonly ? " (rdonly)" : ""); - + if (util::kill_process(ctx.hpfs_pid, true) == -1) return -1;