Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mxqd: Fix reaper - pid might not be known when recovering so reap by …
…job_id
  • Loading branch information
mariux committed Nov 27, 2015
1 parent 0f3cc2f commit 2d72507
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mxqd.c
Expand Up @@ -1787,7 +1787,7 @@ static int fspool_process_file(struct mxq_server *server,char *filename, uint64_

mx_log_info("job finished (via fspool) : job %lu pid %d status %d", job_id, pid, status);

jlist = server_remove_job_list_by_pid(server, pid);
jlist = server_remove_job_list_by_job_id(server, job_id);
if (!jlist) {
mx_log_warning("fspool_process_file: %s : job unknown on server", filename);
return -(errno=ENOENT);
Expand Down Expand Up @@ -1921,7 +1921,7 @@ static int lost_scan_one(struct mxq_server *server)
mx_log_warning("pid %u: process is gone. cancel job %lu",
jlist->job.host_pid,
jlist->job.job_id);
server_remove_job_list_by_pid(server, job->host_pid);
server_remove_job_list_by_job_id(server, job->job_id);

job->job_status = MXQ_JOB_STATUS_UNKNOWN;

Expand Down
13 changes: 13 additions & 0 deletions mxqd_control.c
Expand Up @@ -227,6 +227,19 @@ struct mxq_job_list *server_remove_job_list_by_pid(struct mxq_server *server, pi
return jlist;
}

struct mxq_job_list *server_remove_job_list_by_job_id(struct mxq_server *server, uint64_t job_id)
{
struct mxq_job_list *jlist;

assert(server);

jlist = server_get_job_list_by_job_id(server, job_id);
if (jlist) {
job_list_remove_self(jlist);
}
return jlist;
}

static struct mxq_user_list *_user_list_find_by_uid(struct mxq_user_list *ulist, uint32_t uid)
{
for (; ulist; ulist = ulist->next) {
Expand Down
2 changes: 2 additions & 0 deletions mxqd_control.h
Expand Up @@ -6,6 +6,8 @@
#include "mxq_job.h"

struct mxq_job_list *server_remove_job_list_by_pid(struct mxq_server *server, pid_t pid);
struct mxq_job_list *server_remove_job_list_by_job_id(struct mxq_server *server, uint64_t job_id);

struct mxq_group_list *server_update_group(struct mxq_server *server, struct mxq_group *group);

struct mxq_group_list *server_get_group_list_by_group_id(struct mxq_server *server, uint64_t group_id);
Expand Down

0 comments on commit 2d72507

Please sign in to comment.