Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-25751] Fix core dump at logging error message from ER_HB_PROCESS_EVENT #5727

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/executables/master_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3599,7 +3599,7 @@ hb_resource_job_confirm_start (HB_JOB_ARG * arg)
/* shutdown working server processes to change its role to slave */
snprintf (hb_info_str, HB_INFO_STR_MAX, "%s The master node failed to restart the server process",
HA_FAILBACK_DIAG_STRING);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str);
error = hb_resource_job_queue (HB_RJOB_DEMOTE_START_SHUTDOWN, NULL, HB_JOB_TIMER_IMMEDIATELY);
assert (error == NO_ERROR);

Expand Down Expand Up @@ -4154,11 +4154,10 @@ hb_cleanup_conn_and_start_process (CSS_CONN_ENTRY * conn, SOCKET sfd)
/* demote the current node */
hb_Resource->state = HB_NSTATE_SLAVE;

snprintf (error_string, LINE_MAX, "(args:%s)", proc->args);
snprintf (hb_info_str, HB_INFO_STR_MAX,
"%s Server process failure repeated within a short period of time. The current node will be demoted",
HA_FAILBACK_DIAG_STRING);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str);
"%s The master node failed to restart the server process due to repeated failures within a short period of time. The current node will be demoted (args:%s)",
HA_FAILBACK_DIAG_STRING, proc->args);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str);

error = hb_resource_job_queue (HB_RJOB_DEMOTE_START_SHUTDOWN, NULL, HB_JOB_TIMER_IMMEDIATELY);
assert (error == NO_ERROR);
Expand Down Expand Up @@ -4844,13 +4843,17 @@ hb_thread_check_disk_failure (void *arg)
{
snprintf (hb_info_str, HB_INFO_STR_MAX,
"%s The master node has lost its role due to server process problem, such as disk failure",
HA_FAILOVER_DIAG_STRING);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str);
HA_FAILBACK_DIAG_STRING);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str);

/* be silent to avoid blocking write operation on disk */
hb_disable_er_log (HB_NOLOG_DEMOTE_ON_DISK_FAIL, NULL);
hb_Resource->state = HB_NSTATE_SLAVE;

snprintf (hb_info_str, HB_INFO_STR_MAX, "%s Current node has been successfully demoted to slave",
HA_FAILBACK_SUCCESS_STRING);
MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str);

pthread_mutex_unlock (&hb_Resource->lock);
pthread_mutex_unlock (&hb_Cluster->lock);
#if !defined(WINDOWS)
Expand Down
Loading