barman recover returns EXCEPTION: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'

20 views
Skip to first unread message

Marc

unread,
Aug 30, 2023, 7:21:03 AM8/30/23
to Barman, Backup and Recovery Manager for PostgreSQL
Hello,

I am running Barman on macOS Ventura (13.5), installed via MacPorts.
The backups and WAL archiving seems to be working ok, but when I try to recover a backup to a local drive, the barman command returns the following:

> sudo -u barman barman recover pg 20230829T103804 /Volumes/Disk2/RECOVERYTEST/

Starting local restore for server pg using backup 20230829T103804

Destination directory: /Volumes/Disk2/RECOVERYTEST/

Copying the base backup.

EXCEPTION: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'

See log file for more details.



The barman log shows some more info:

2023-08-30 13:06:05,984 [95906] barman.command_wrappers DEBUG: Command stderr:
2023-08-30 13:06:05,991 [95906] barman.copy_controller INFO: Copy failed (safe before None)
2023-08-30 13:06:05,992 [95906] barman.cli ERROR: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'
See log file for more details.
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/cli.py", line 2101, in main
    args.func(args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/cli.py", line 993, in recover
    server.recover(
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/server.py", line 1882, in recover
    return self.backup_manager.recover(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/backup.py", line 777, in recover
    recovery_info = executor.recover(
                    ^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/recovery_executor.py", line 189, in recover
    self._backup_copy(
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/recovery_executor.py", line 802, in _backup_copy
    controller.copy()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/barman/copy_controller.py", line 566, in copy
    pool = Pool(
           ^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
    self._repopulate_pool()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
    w.start()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 288, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'



Anyone have any idea what is causing this error and how to fix it?
The permissions for the destination directory are all in order. Barman creates the entire PGDATA structure, but the folder are empty.

Mike Wallace

unread,
Aug 30, 2023, 9:32:56 AM8/30/23
to pgba...@googlegroups.com
Hi Marc,

Thanks for reporting the issue. I've managed to reproduce it locally using a from-source installation with python3.11 on macOS Big Sur:

barman recover mt-primary 20210705T100000 /tmp/recovered
Starting local restore for server mt-primary using backup 20210705T100000
Destination directory: /tmp/recovered
        16616, foo, /tmp/tablespace

Copying the base backup.
EXCEPTION: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'
See log file for more details.

I have filed https://github.com/EnterpriseDB/barman/issues/838 so we can investigate further.

Best regards,

Mike

--
--
You received this message because you are subscribed to the "Barman for PostgreSQL" group.
To post to this group, send email to pgba...@googlegroups.com
To unsubscribe from this group, send email to
pgbarman+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pgbarman?hl=en?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pgbarman/881779a0-0b7d-4790-ab0d-c59e861c1921n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages