Skip to content

Cronjobs failing due to flock not obvious #452

@rocketeerbkw

Description

@rocketeerbkw

In #192 we prefixed all cron jobs with flock to prevent concurrent runs. When flock errors there are no logs so it's not clear if that or the cronjob itself is failing:

time="2025-08-28T10:31:00Z" level=debug msg=executing command="flock -n /tmp/cron.lock.747a6372b42e78c58e130f4618aad7293d6d92096010ff5df770ee08cd5712bd -c 'drush elysia-cron run @default'" spec="* * * * " user=root
time="2025-08-28T10:31:00Z" level=error command="flock -n /tmp/cron.lock.747a6372b42e78c58e130f4618aad7293d6d92096010ff5df770ee08cd5712bd -c 'drush elysia-cron run @default'" result=error spec="
* * * *" user=root

The only way to diagnose this is to see that the time between logs is very short (~6 ns) and to run ps aux to see if an old process is still running.

Some flavors of flock include --verbose and --conflict-exit-code args which could be used, but looks like busybox flock offers nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions