citusdata / citusdata/pg_cron

Pg_cron scheduler not restarting

Open
#399 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.9k
Forks
260
Avg merge
5d 5h
Merged PRs (30d)
1

Description

I recently had an issue with the pg_cron scheduler process not being able to restart, using version 1.6 on RDS.

Everything had been running smoothly for several weeks until last weekend the process died and the restart kept failing with loads of "background worker "pg_cron launcher" (PID xxx) exited with exit code 1" messages.

I eventually found matching 'ERROR: role "..." does not exist' messages and the fix was to change the account for the jobs concerned.

However:
1. It had been working fine even with the account removed
2. All the jobs for the missing user account were set as inactive

It appears that the user account check is only done at the point the scheduler process tries to start. IMHO this is a heavy handed approach. Wouldn't it be better to ignore inactive jobs rather than block the whole scheduler from running?
Possibly just check for the account existence when a job becomes active although it would just error at runtime anyway.

Mark

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the pg_cron launcher startup path described in the issue, focusing on how inactive jobs and missing roles are handled. Reproduce the restart failure with an inactive job owned by a removed role, then inspect the existing scheduler tests and add coverage showing the expected startup behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.