fix kill worker cause controller die
This commit is contained in:
parent
9e07a1b227
commit
06c561cea4
2 changed files with 15 additions and 2 deletions
|
|
@ -557,8 +557,9 @@ static int make_heartbeat(cluster_t* c, endpoint_t* ep)
|
||||||
|
|
||||||
static int check_worker_timeout_(void* arg1, void* arg2)
|
static int check_worker_timeout_(void* arg1, void* arg2)
|
||||||
{
|
{
|
||||||
cluster_t* c = (cluster_t*)arg1;
|
cluster_t* c = (cluster_t*)arg1;
|
||||||
worker_t* w = (worker_t*)arg2;
|
worker_t* w = (worker_t*)arg2;
|
||||||
|
worker_t* w1 = NULL;
|
||||||
endpoint_t* ep;
|
endpoint_t* ep;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
@ -577,6 +578,12 @@ static int check_worker_timeout_(void* arg1, void* arg2)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* grab lock on worker */
|
||||||
|
w1 = obj_ref(w, OBJREF_UPDATE);
|
||||||
|
if (w1 == NULL) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
config = c->myconf->cluster_config;
|
config = c->myconf->cluster_config;
|
||||||
timeout = config->heartbeat_interval * config->inactive_heartbeat_count;
|
timeout = config->heartbeat_interval * config->inactive_heartbeat_count;
|
||||||
|
|
||||||
|
|
@ -585,6 +592,7 @@ static int check_worker_timeout_(void* arg1, void* arg2)
|
||||||
w->host.name);
|
w->host.name);
|
||||||
|
|
||||||
mark_worker_unavail(c, w);
|
mark_worker_unavail(c, w);
|
||||||
|
obj_deref(w1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -603,11 +611,14 @@ static int check_worker_timeout_(void* arg1, void* arg2)
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
ERROR("%s make_heartbeat to %s failed", __func__, w->host.name);
|
ERROR("%s make_heartbeat to %s failed", __func__, w->host.name);
|
||||||
|
|
||||||
|
obj_deref(w1);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obj_deref(w1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -521,6 +521,8 @@ int handle_worker_leave(cluster_t* c, int idx)
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w->ep = NULL;
|
||||||
|
|
||||||
mark_worker_unavail(c, w);
|
mark_worker_unavail(c, w);
|
||||||
|
|
||||||
obj_deref(w);
|
obj_deref(w);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue