mirror of
https://github.com/emqx/neuron.git
synced 2026-10-31 00:19:15 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc86ffd497 | ||
|
|
f32188e3c1 | ||
|
|
93af6bfe76 | ||
|
|
5c543e0077 | ||
|
|
f6c591e951 | ||
|
|
eb332bd745 | ||
|
|
d026d1f754 | ||
|
|
fd6c3aca96 | ||
|
|
faee3ab68c | ||
|
|
68587420e0 |
@@ -8,8 +8,8 @@ on:
|
||||
- published
|
||||
|
||||
env:
|
||||
VERSION: 2.3.7
|
||||
UI_VERSION: 2.3.6
|
||||
VERSION: 2.3.8
|
||||
UI_VERSION: 2.3.7
|
||||
BRANCH: v2.3
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -58,43 +58,27 @@ void handle_logs_files(nng_aio *aio)
|
||||
|
||||
VALIDATE_JWT(aio);
|
||||
|
||||
rv = mkdir("neuron_logs", S_IRWXU);
|
||||
if (0 != rv && EEXIST == errno) {
|
||||
rv = 0;
|
||||
}
|
||||
|
||||
// check if coredump exists
|
||||
rv = access("./core", F_OK);
|
||||
if (0 == rv) {
|
||||
rv = system("cp -r ./core neuron_logs");
|
||||
if (0 != rv) {
|
||||
nlog_error("failed to copy coredump file");
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_COMMAND_EXECUTION_FAILED, {
|
||||
http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rv = system("cp -r ./logs neuron_logs");
|
||||
/* check whether the neuron directory exists */
|
||||
rv = access("../neuron", F_OK);
|
||||
if (0 != rv) {
|
||||
nlog_error("failed to copy logs file");
|
||||
nlog_error("The neuron directory does not exists");
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_FILE_NOT_EXIST, {
|
||||
http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
/* tar the neuron directory */
|
||||
rv = system("tar -zcvf neuron_debug.tar.gz ../neuron");
|
||||
if (0 != rv) {
|
||||
nlog_error("failed to create neuron_debug.tar.gz");
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_COMMAND_EXECUTION_FAILED, {
|
||||
http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
rv = system("tar -zcvf neuron_logs.tar.gz neuron_logs");
|
||||
if (0 != rv) {
|
||||
nlog_error("failed to create neuron_logs.tar.gz");
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_COMMAND_EXECUTION_FAILED, {
|
||||
http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(path, "neuron_logs.tar.gz");
|
||||
strcpy(path, "neuron_debug.tar.gz");
|
||||
rv = read_file(path, &data, &len);
|
||||
if (0 != rv) {
|
||||
NEU_JSON_RESPONSE_ERROR(
|
||||
@@ -102,18 +86,8 @@ void handle_logs_files(nng_aio *aio)
|
||||
return;
|
||||
}
|
||||
|
||||
// delete neuron_logs folder from build
|
||||
rv = system("rm -rf neuron_logs.tar.gz neuron_logs");
|
||||
if (0 != rv) {
|
||||
nlog_error("failed to delete neuron_logs folder");
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_COMMAND_EXECUTION_FAILED, {
|
||||
http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// handle http response
|
||||
strcpy(disp, "attachment; filename=neuron_logs.tar.gz");
|
||||
/* handle http response */
|
||||
strcpy(disp, "attachment; filename=neuron_debug.tar.gz");
|
||||
rv = http_resp_files(aio, data, len, disp);
|
||||
if (0 != rv) {
|
||||
return;
|
||||
|
||||
@@ -389,7 +389,7 @@ ssize_t neu_conn_recv(neu_conn_t *conn, uint8_t *buf, ssize_t len)
|
||||
conn->fd, len, ret, strerror(errno), errno);
|
||||
}
|
||||
|
||||
if (errno == EPIPE || ret == -1) {
|
||||
if (errno == EPIPE || ret == -1 || ret == 0) {
|
||||
conn_disconnect(conn);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,11 @@ static void *event_loop(void *arg)
|
||||
if (ret == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret == -1 && errno == EINTR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ret == -1 || events->stop) {
|
||||
zlog_warn(neuron, "event loop exit, errno: %s(%d), stop: %d",
|
||||
strerror(errno), errno, events->stop);
|
||||
|
||||
@@ -48,6 +48,7 @@ static void sig_handler(int sig)
|
||||
}
|
||||
zlog_fini();
|
||||
exit_flag = true;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static int neuron_run(const neu_cli_args_t *args)
|
||||
@@ -58,6 +59,7 @@ static int neuron_run(const neu_cli_args_t *args)
|
||||
signal(SIGINT, sig_handler);
|
||||
signal(SIGTERM, sig_handler);
|
||||
signal(SIGABRT, sig_handler);
|
||||
signal(SIGSEGV, sig_handler);
|
||||
|
||||
// try to enable core dump
|
||||
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
|
||||
|
||||
Reference in New Issue
Block a user