Skip to content

Commit

Permalink
Merge pull request #15526 from bluca/start_stop_wait_debug
Browse files Browse the repository at this point in the history
Add debug log when a job in the activation queue is not runnable
  • Loading branch information
keszybz committed Apr 22, 2020
2 parents 9df91db + c03fbd3 commit eecf4f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/core/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,20 @@ static bool job_is_runnable(Job *j) {
return true;

HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_AFTER], i)
if (other->job && job_compare(j, other->job, UNIT_AFTER) > 0)
if (other->job && job_compare(j, other->job, UNIT_AFTER) > 0) {
log_unit_debug(j->unit,
"starting held back, waiting for: %s",
other->id);
return false;
}

HASHMAP_FOREACH_KEY(v, other, j->unit->dependencies[UNIT_BEFORE], i)
if (other->job && job_compare(j, other->job, UNIT_BEFORE) > 0)
if (other->job && job_compare(j, other->job, UNIT_BEFORE) > 0) {
log_unit_debug(j->unit,
"stopping held back, waiting for: %s",
other->id);
return false;
}

return true;
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,9 @@ int unit_can_clean(Unit *u, ExecCleanMask *ret_mask);
#define log_unit_full(unit, level, error, ...) \
({ \
const Unit *_u = (unit); \
_u ? log_object_internal(level, error, PROJECT_FILE, __LINE__, __func__, _u->manager->unit_log_field, _u->id, _u->manager->invocation_log_field, _u->invocation_id_string, ##__VA_ARGS__) : \
log_internal(level, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
(log_get_max_level() < LOG_PRI(level)) ? -ERRNO_VALUE(error) : \
_u ? log_object_internal(level, error, PROJECT_FILE, __LINE__, __func__, _u->manager->unit_log_field, _u->id, _u->manager->invocation_log_field, _u->invocation_id_string, ##__VA_ARGS__) : \
log_internal(level, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
})

#define log_unit_debug(unit, ...) log_unit_full(unit, LOG_DEBUG, 0, ##__VA_ARGS__)
Expand Down

0 comments on commit eecf4f7

Please sign in to comment.