diff --git a/src/modules/job-info/guest_watch.c b/src/modules/job-info/guest_watch.c index 749fc4a5f6f7..14900b708cd8 100644 --- a/src/modules/job-info/guest_watch.c +++ b/src/modules/job-info/guest_watch.c @@ -587,6 +587,7 @@ static void guest_namespace_watch_continuation (flux_future_t *f, void *arg) struct guest_watch_ctx *gw = arg; struct info_ctx *ctx = gw->ctx; const char *event; + bool skip_respond_error = false; if (flux_job_event_watch_get (f, &event) < 0) { if (errno == ENOTSUP) { @@ -639,6 +640,7 @@ static void guest_namespace_watch_continuation (flux_future_t *f, void *arg) if (flux_respond_pack (ctx->h, gw->msg, "{s:s}", "event", event) < 0) { flux_log_error (ctx->h, "%s: flux_respond_pack", __FUNCTION__); + skip_respond_error = true; goto error_cancel; } @@ -657,6 +659,9 @@ static void guest_namespace_watch_continuation (flux_future_t *f, void *arg) errno = save_errno; } + if (skip_respond_error) + goto cleanup; + error: if (flux_respond_error (ctx->h, gw->msg, errno, NULL) < 0) flux_log_error (ctx->h, "%s: flux_respond_error", __FUNCTION__); @@ -763,7 +768,7 @@ static void main_namespace_lookup_continuation (flux_future_t *f, void *arg) "event", tok, toklen) < 0) { flux_log_error (ctx->h, "%s: flux_respond_pack", __FUNCTION__); - goto error; + goto cleanup; } } diff --git a/src/modules/job-info/update.c b/src/modules/job-info/update.c index a607791d21e9..4c052f13aed8 100644 --- a/src/modules/job-info/update.c +++ b/src/modules/job-info/update.c @@ -143,6 +143,7 @@ static void eventlog_continuation (flux_future_t *f, void *arg) json_t *context = NULL; const char *errmsg = NULL; const flux_msg_t *msg; + bool skip_respond_error = false; if (flux_rpc_get (f, NULL) < 0) { /* ENODATA is normal when job finishes or we've sent cancel */ @@ -196,6 +197,7 @@ static void eventlog_continuation (flux_future_t *f, void *arg) "{s:O}", uc->key, uc->update_object) < 0) { flux_log_error (ctx->h, "%s: flux_respond", __FUNCTION__); + skip_respond_error = true; goto error_cancel; } msg = flux_msglist_next (uc->msglist); @@ -212,6 +214,9 @@ static void eventlog_continuation (flux_future_t *f, void *arg) * freed */ eventlog_watch_cancel (uc); + if (skip_respond_error) + goto cleanup; + error: msg = flux_msglist_first (uc->msglist); while (msg) { @@ -360,7 +365,7 @@ static void lookup_continuation (flux_future_t *f, void *arg) if (flux_respond_pack (uc->ctx->h, msg, "{s:O}", uc->key, uc->update_object) < 0) { flux_log_error (ctx->h, "%s: flux_respond", __FUNCTION__); - goto error; + goto cleanup; } next: @@ -520,7 +525,7 @@ void update_watch_cb (flux_t *h, "{s:O}", uc->key, uc->update_object) < 0) { flux_log_error (ctx->h, "%s: flux_respond", __FUNCTION__); - goto error; + goto cleanup; } } /* if uc->update_object has not been set, the initial lookup @@ -536,6 +541,7 @@ void update_watch_cb (flux_t *h, error: if (flux_respond_error (h, msg, errno, errmsg) < 0) flux_log_error (h, "%s: flux_respond_error", __FUNCTION__); +cleanup: free (index_key); } diff --git a/src/modules/job-info/watch.c b/src/modules/job-info/watch.c index e0ccf3966bd9..b6c86cfa4954 100644 --- a/src/modules/job-info/watch.c +++ b/src/modules/job-info/watch.c @@ -224,6 +224,7 @@ static void watch_continuation (flux_future_t *f, void *arg) const char *tok; size_t toklen; const char *errmsg = NULL; + bool skip_respond_error = false; if (flux_kvs_lookup_get (f, &s) < 0) { if (errno != ENOENT && errno != ENODATA && errno != ENOTSUP) @@ -266,6 +267,7 @@ static void watch_continuation (flux_future_t *f, void *arg) flux_log_error (ctx->h, "%s: flux_respond_pack", __FUNCTION__); + skip_respond_error = true; goto error_cancel; } @@ -306,6 +308,9 @@ static void watch_continuation (flux_future_t *f, void *arg) errno = save_errno; } + if (skip_respond_error) + goto cleanup; + error: if (flux_respond_error (ctx->h, w->msg, errno, errmsg) < 0) flux_log_error (ctx->h, "%s: flux_respond_error", __FUNCTION__);