Menu

#108 Python 3.8/macOS: Syncing backups from primary server fails with 'Cannot pickle local object'

2.x
open
nobody
None
2020-09-10
2020-09-10
No

Using Barman with Python 3.8 on macOS as a passive server to sync backups from a primary backup server fails with the message (myserver is the backup configuration name):

barman.server ERROR: Backup failed syncing with myserver: Can't pickle local object 'Command.make_logging_handler.<locals>.handler'</locals>

This happens in copy_controller.py: RsyncCopyController.copy line 519 (barmann 2.11) when creating a multiprocess pool object.

The reason for that error seems to be, that Python 3.8 changed the multiprocess start method on macOS from 'fork' to 'spawn' (https://docs.python.org/3/library/multiprocessing.html). Apparently with 'spawn' all parameters have to be picklable, but the "handler" function is local to the make_logging_handler method and therefore cannot be pickled.

A temporary workaround is to call multiprocessing.set_start_method('fork') as basically the first statement in barman.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB