Skip to content

Wal-archiving OK. Backup failed #460

Closed

Description

@theo-bot

After we implemented the new objectstore object in our lab. The wal archiving started immediately. However the backups keep failing.

Cluster configuration:
`apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
labels:
app: db
name: my-db17
namespace: my-db-lab
resourceVersion: "6121832200"
uid: 9b308f82-2b5e-436d-8fa2-8dc3e847ef5d
spec:
affinity:
enablePodAntiAffinity: true
podAntiAffinityType: preferred
topologyKey: kubernetes.io/hostname
bootstrap:
initdb:
database: orggeodb
encoding: UTF8
localeCType: C
localeCollate: C
owner: orggeodb
postInitApplicationSQLRefs:
configMapRefs:
- key: configmap.sql
name: init-sql
secret:
name: db-user-secret
enablePDB: false
enableSuperuserAccess: true
failoverDelay: 0
imageName: harbor.local.net/ghcr-io-proxy/cloudnative-pg/postgis:17-3.5-169
inheritedMetadata:
labels:
app: database
group: my-db
name: db-postgres
tier: zeer-vertrouwd
instances: 1
logLevel: debug
maxSyncReplicas: 0
minSyncReplicas: 0
monitoring:
customQueriesConfigMap:
- key: queries
name: cnpg-default-monitoring
disableDefaultQueries: false
enablePodMonitor: true
plugins:

  • enabled: true
    isWALArchiver: true
    name: barman-cloud.cloudnative-pg.io
    parameters:
    barmanObjectName: minio-store
    postgresGID: 26
    postgresUID: 26
    postgresql:
    parameters:
    archive_mode: "on"
    archive_timeout: 5min
    checkpoint_completion_target: "0.5"
    default_statistics_target: "100"
    dynamic_shared_memory_type: posix
    effective_cache_size: 2250MB
    effective_io_concurrency: "1"
    full_page_writes: "on"
    log_connections: "on"
    log_destination: csvlog
    log_directory: /controller/log
    log_filename: postgres
    log_rotation_age: "0"
    log_rotation_size: "0"
    log_truncate_on_rotation: "false"
    logging_collector: "on"
    maintenance_work_mem: 64MB
    max_connections: "100"
    max_parallel_maintenance_workers: "2"
    max_parallel_workers: "32"
    max_parallel_workers_per_gather: "2"
    max_replication_slots: "32"
    max_wal_size: 1GB
    max_worker_processes: "32"
    min_wal_size: 80MB
    random_page_cost: "4"
    shared_buffers: 256MB
    shared_memory_type: mmap
    shared_preload_libraries: ""
    ssl_max_protocol_version: TLSv1.3
    ssl_min_protocol_version: TLSv1.3
    wal_buffers: 8MB
    wal_keep_size: 512MB
    wal_level: logical
    wal_log_hints: "on"
    wal_receiver_timeout: 5s
    wal_sender_timeout: 5s
    work_mem: 512MB
    shared_preload_libraries:
    • pgaudit
      syncReplicaElectionConstraint:
      enabled: false
      primaryUpdateMethod: restart
      primaryUpdateStrategy: unsupervised
      replicationSlots:
      highAvailability:
      enabled: true
      slotPrefix: cnpg
      synchronizeReplicas:
      enabled: true
      updateInterval: 30
      resources:
      limits:
      cpu: "4"
      memory: 8G
      requests:
      cpu: "2"
      memory: 8G
      smartShutdownTimeout: 180
      startDelay: 30
      stopDelay: 30
      storage:
      resizeInUseVolumes: true
      size: 160Gi
      switchoverDelay: 40000000
      `

Object store config:
apiVersion: barmancloud.cnpg.io/v1 kind: ObjectStore metadata: name: minio-store spec: configuration: data: compression: gzip immediateCheckpoint: true destinationPath: s3://my-db17 endpointURL: https://minio.local.net s3Credentials: accessKeyId: name: minio-user key: user secretAccessKey: name: minio-user key: password tags: backupRetentionPolicy: expire historyTags: backupRetentionPolicy: keep wal: compression: gzip maxParallel: 8 retentionPolicy: 5d
Backup config:
apiVersion: postgresql.cnpg.io/v1 kind: Backup metadata: name: base-backup spec: cluster: name: my-db17 backupOwnerReference: self method: plugin pluginConfiguration: name: barman-cloud.cloudnative-pg.io

Posgres container barman messages:
{ "level": "debug", "ts": "2025-08-06T07:56:21.161551803Z", "logger": "setPluginProtocol", "msg": "Connecting to plugin via local socket", "pluginName": "barman-cloud.cloudnative-pg.io", "caller": "internal/cnpi/plugin/connection/unix.go:41", "logging_pod": "my-db17-1", "path": "unix:///plugins/barman-cloud.cloudnative-pg.io" } { "level": "info", "ts": "2025-08-06T07:56:21.688820137Z", "msg": "Plugin backup started", "pluginConfiguration": { "name": "barman-cloud.cloudnative-pg.io" }, "backupName": "my-db17-20250806090620", "backupNamespace": "my-db-lab", "logging_pod": "my-db17-1" } { "level": "debug", "ts": "2025-08-06T08:36:51.602252229Z", "logger": "setPluginProtocol", "msg": "Connecting to plugin via local socket", "pluginName": "barman-cloud.cloudnative-pg.io", "caller": "internal/cnpi/plugin/connection/unix.go:41", "logging_pod": "my-db17-1", "path": "unix:///plugins/barman-cloud.cloudnative-pg.io" } { "level": "info", "ts": "2025-08-06T08:36:51.789443756Z", "msg": "Plugin backup started", "pluginConfiguration": { "name": "barman-cloud.cloudnative-pg.io" }, "backupName": "base-backup", "backupNamespace": "my-db-lab", "logging_pod": "my-db17-1" } { "level": "error", "ts": "2025-08-06T08:41:20.589908496Z", "msg": "Error while calling Backup, failing", "pluginName": "barman-cloud.cloudnative-pg.io", "logging_pod": "my-db17-1", "error": "rpc error: code = Unknown desc = signal: killed", "stacktrace": "github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/machinery@v0.3.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cnpi/plugin/client.(*data).Backup\n\tinternal/cnpi/plugin/client/backup.go:154\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/postgres/webserver.(*PluginBackupCommand).invokeStart\n\tpkg/management/postgres/webserver/plugin_backup.go:114" } { "level": "info", "ts": "2025-08-06T08:41:35.793723168Z", "logger": "postgres", "msg": "record", "logging_pod": "my-db17-1", "record": { "log_time": "2025-08-06 08:41:35.793 UTC", "user_name": "postgres", "database_name": "postgres", "process_id": "4861", "connection_from": "[local]", "session_id": "68931510.12fd", "session_line_num": "4", "command_tag": "idle", "session_start_time": "2025-08-06 08:40:48 UTC", "virtual_transaction_id": "49/0", "transaction_id": "0", "error_severity": "WARNING", "sql_state_code": "01000", "message": "aborting backup due to backend exiting before pg_backup_stop was called", "application_name": "barman_cloud_backup", "backend_type": "client backend", "query_id": "0" } } { "level": "error", "ts": "2025-08-06T08:41:35.888540842Z", "msg": "Error while calling Backup, failing", "pluginName": "barman-cloud.cloudnative-pg.io", "logging_pod": "my-db17-1", "error": "rpc error: code = Unknown desc = signal: killed", "stacktrace": "github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\tpkg/mod/github.com/cloudnative-pg/machinery@v0.3.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/internal/cnpi/plugin/client.(*data).Backup\n\tinternal/cnpi/plugin/client/backup.go:154\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/postgres/webserver.(*PluginBackupCommand).invokeStart\n\tpkg/management/postgres/webserver/plugin_backup.go:114" }

Plugin sidecar logging:
{"level":"info","ts":"2025-08-06T08:41:08.288292736Z","logger":"barman-cloud-backup","msg":"/usr/local/lib/python3.13/site-packages/barman/cloud.py:224: FutureWarning: functools.partial will be a method descriptor in future Python versions; wrap it in staticmethod() if you want to preserve the old behavior","pipe":"stderr","logging_pod":"my-db17-1"} {"level":"info","ts":"2025-08-06T08:41:08.288341937Z","logger":"barman-cloud-backup","msg":" self.buffer = self._buffer()","pipe":"stderr","logging_pod":"my-db17-1"} {"level":"error","ts":"2025-08-06T08:41:20.589237589Z","msg":"while taking backup","logging_pod":"my-db17-1","error":"signal: killed","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.BackupServiceImplementation.Backup\n\t/workspace/internal/cnpgi/instance/backup.go:102\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler.func1\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:140\ngithub.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/v2@v2.3.2/interceptors/recovery/interceptors.go:34\ngoogle.golang.org/grpc.getChainUnaryHandler.func1.getChainUnaryHandler.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1217\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.loggingUnaryServerInterceptor.func3\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:37\ngoogle.golang.org/grpc.getChainUnaryHandler.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1217\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.logFailedRequestsUnaryServerInterceptor.func2\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:49\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1208\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:142\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1405\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1815\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1035"} {"level":"error","ts":"2025-08-06T08:41:20.589419145Z","msg":"Error while handling GRPC request","logging_pod":"my-db17-1","info":{"Server":{"Client":{"Client":{}},"InstanceName":"my-db17-1"},"FullMethod":"/cnpgi.backup.v1.Backup/Backup"},"error":"signal: killed","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.logFailedRequestsUnaryServerInterceptor.func2\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:51\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1208\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:142\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1405\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1815\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1035"} {"level":"error","ts":"2025-08-06T08:41:22.088247336Z","msg":"Error invoking barman-cloud-wal-archive","logging_pod":"my-db17-1","walName":"/var/lib/postgresql/data/pgdata/pg_wal/00000001000000ED000000E4","options":["--gzip","--endpoint-url","https://minio.my-db-lab.local.net","--tags","backupRetentionPolicy,expire","--history-tags","backupRetentionPolicy,keep","--cloud-provider","aws-s3","s3://my-db17","my-db17","/var/lib/postgresql/data/pgdata/pg_wal/00000001000000ED000000E4"],"exitCode":-1,"error":"signal: killed","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/barman-cloud/pkg/walarchive.(*BarmanArchiver).Archive\n\t/go/pkg/mod/github.com/cloudnative-pg/barman-cloud@v0.3.1/pkg/walarchive/cmd.go:83\ngithub.com/cloudnative-pg/barman-cloud/pkg/walarchive.(*BarmanArchiver).ArchiveList.func1\n\t/go/pkg/mod/github.com/cloudnative-pg/barman-cloud@v0.3.1/pkg/walarchive/cmd.go:115"} {"level":"info","ts":"2025-08-06T08:41:22.288149608Z","msg":"Failed archiving WAL: PostgreSQL will retry","logging_pod":"my-db17-1","walName":"/var/lib/postgresql/data/pgdata/pg_wal/00000001000000ED000000E4","startTime":"2025-08-06T08:37:13.594908324Z","endTime":"2025-08-06T08:41:22.288132592Z","elapsedWalTime":248.693224287,"error":"unexpected failure invoking barman-cloud-wal-archive: signal: killed"} {"level":"error","ts":"2025-08-06T08:41:35.888120702Z","msg":"while taking backup","logging_pod":"my-db17-1","error":"signal: killed","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance.BackupServiceImplementation.Backup\n\t/workspace/internal/cnpgi/instance/backup.go:102\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler.func1\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:140\ngithub.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware/v2@v2.3.2/interceptors/recovery/interceptors.go:34\ngoogle.golang.org/grpc.getChainUnaryHandler.func1.getChainUnaryHandler.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1217\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.loggingUnaryServerInterceptor.func3\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:37\ngoogle.golang.org/grpc.getChainUnaryHandler.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1217\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.logFailedRequestsUnaryServerInterceptor.func2\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:49\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1208\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:142\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1405\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1815\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1035"} {"level":"error","ts":"2025-08-06T08:41:35.888215885Z","msg":"Error while handling GRPC request","logging_pod":"my-db17-1","info":{"Server":{"Client":{"Client":{}},"InstanceName":"my-db17-1"},"FullMethod":"/cnpgi.backup.v1.Backup/Backup"},"error":"signal: killed","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/machinery@v0.2.0/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.logFailedRequestsUnaryServerInterceptor.func2\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i-machinery@v0.3.0/pkg/pluginhelper/http/grpc.go:51\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1208\ngithub.com/cloudnative-pg/cnpg-i/pkg/backup._Backup_Backup_Handler\n\t/go/pkg/mod/github.com/cloudnative-pg/cnpg-i@v0.2.1/pkg/backup/backup_grpc.pb.go:142\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1405\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1815\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.72.2/server.go:1035"}

Activity

  1. added
    bug
    on Aug 6, 2025
  2. dosubot commented on Aug 6, 2025

    @dosubot

    Hi @theo-bot! I'm Dosu and I’m helping the plugin-barman-cloud team.

    The signal: killed error during backup almost always means the backup process was terminated by the OS, usually because it exceeded the pod's memory or CPU limits (for example, an OOMKilled event in Kubernetes). WAL archiving works because it's much less resource-intensive than a full backup, which can require a lot more memory and CPU.

    Check your pod events (kubectl describe pod <pod-name>) for OOMKilled or similar signals during backup attempts. Monitor actual resource usage (kubectl top pod <pod-name>) during backup to see if you're hitting your limits. If so, increase your pod's memory and/or CPU limits—8GiB may not be enough for some backup workloads, especially with compression enabled.

    Also, make sure your memory requests are not lower than your shared_buffers setting. Recent CloudNativePG versions enforce this, and misconfigurations here can cause OOM issues during backup as well [source].

    If resource adjustments don't resolve it, check MinIO health and network connectivity during backup, as long stalls or failures there can also cause process termination.

    The plugin does not automatically adapt to resource constraints, so right-sizing your pod is key. There are no known bugs or direct troubleshooting steps for this error in the official docs or recent issues. If you need a checklist: check for OOMKilled events, monitor resource usage, increase limits if needed, and verify object store health.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about plugin-barman-cloud Share Dosu with your team

  3. theo-bot commented on Aug 6, 2025

    @theo-bot
    Author

    Hi @dosu,

    I was indeed the resource settings.

    Thnx, Theo

  4. dosubot commented on Aug 6, 2025

    @dosubot

    You're welcome! Happy to help. If you ever need to tune resource settings again, the CloudNativePG docs have some useful tips on resource sizing and backup best practices.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about plugin-barman-cloud with Dosu Add Dosu to your team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions