Failed to start a background worker error, TimescaleDB

In brief:

Logs show errors including the phrase Failed to start a background worker.

TimescaleDB version: Multiple releases
PostgreSQL version: Multiple releases
Platform: Cross-platform, cloud and self-hosted environments

Compression may be failing and there will be variations of this warning message. For example:

  • "Compression Policy [n]": failed to start a background worker
  • "Telemetry Reporter [n]": failed to start a background worker

This issue often arises when worker settings are not properly set. There are three key settings: max_worker_processes , max_parallel_workers , and timescaledb.max_background_workers

These should be set according to these rules of thumb:

timescaledb.max_background_workers = number of databases + number of concurrent background workers

max_worker_processes = timescaledb.max_background_workers + max_parallel_workers

Read more about this topic.

3 Likes

I have that settings from helm chart installed in my k8s:

max_wal_size = 1GB
min_wal_size = 512MB
shared_preload_libraries = 'timescaledb'
shared_buffers = 802560kB
effective_cache_size = 2351MB
maintenance_work_mem = 401280kB
work_mem = 8025kB
timescaledb.max_background_workers = 16
max_worker_processes = 21
max_parallel_workers_per_gather = 1
max_parallel_workers = 2
wal_buffers = 16MB
default_statistics_target = 500
random_page_cost = 1.1
checkpoint_completion_target = 0.9
max_connections = 50
max_locks_per_transaction = 64
autovacuum_max_workers = 10
autovacuum_naptime = 10
effective_io_concurrency = 256
timescaledb.last_tuned = '2023-09-01T13:45:45Z'
timescaledb.last_tuned_version = '0.14.3'

But logs from master node is full of errors

timescaledb-1 timescaledb 2023-09-01 13:51:23 UTC [138]: [64f1e8f3.8a-1742] @,app= [01000] WARNING:  failed to launch job 2 "Error Log Retention Policy [2]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [1451]: [64f1ec5c.5ab-1] [unknown]@[unknown],app=[unknown] [00000] LOG:  connection received: host=10.10.78.75 port=6039
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [137]: [64f1e8f3.89-873] @,app= [01000] WARNING:  failed to launch job 1 "Telemetry Reporter [1]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [136]: [64f1e8f3.88-5173] @,app= [01000] WARNING:  failed to launch job 1002 "Refresh Continuous Aggregate Policy [1002]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [141]: [64f1e8f3.8d-5173] @,app= [01000] WARNING:  failed to launch job 1001 "Refresh Continuous Aggregate Policy [1001]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [136]: [64f1e8f3.88-5174] @,app= [01000] WARNING:  failed to launch job 1003 "Refresh Continuous Aggregate Policy [1003]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [136]: [64f1e8f3.88-5175] @,app= [01000] WARNING:  failed to launch job 1000 "Refresh Continuous Aggregate Policy [1000]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [141]: [64f1e8f3.8d-5174] @,app= [01000] WARNING:  failed to launch job 1000 "Refresh Continuous Aggregate Policy [1000]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [136]: [64f1e8f3.88-5176] @,app= [01000] WARNING:  failed to launch job 1001 "Refresh Continuous Aggregate Policy [1001]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [141]: [64f1e8f3.8d-5175] @,app= [01000] WARNING:  failed to launch job 1002 "Refresh Continuous Aggregate Policy [1002]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [136]: [64f1e8f3.88-5177] @,app= [01000] WARNING:  failed to launch job 1 "Telemetry Reporter [1]": failed to start a background worker
timescaledb-1 timescaledb 2023-09-01 13:51:24 UTC [141]: [64f1e8f3.8d-5176] @,app= [01000] WARNING:  failed to launch job 1 "Telemetry Reporter [1]": failed to start a background worker