Menu

#88 Backup fails due to encoding error / solution inside

2.x
closed
nobody
None
2020-01-16
2017-10-22
tionov
No

Here backup fails due to an encoding error:

2017-10-22 18:15:03,442 [23177] barman.backup INFO: Starting backup using postgres method for server mainserv in /var/lib/barman/mainserv/base/20171022T181503
2017-10-22 18:15:03,614 [23177] barman.backup_executor INFO: Backup start at LSN: 7/68D09538 (000000010000000700000068, 00D09538)
2017-10-22 18:15:03,623 [23177] barman.backup_executor INFO: Starting backup copy via pg_basebackup for 20171022T181503
2017-10-22 18:15:04,392 [2948] barman.command_wrappers INFO: mainserv: pg_receivexlog: Segment bei 7/69000000 abgeschlossen (Zeitleiste 1)
2017-10-22 18:15:07,095 [23177] barman.cli ERROR: 'ascii' codec can't encode character u'\xfc' in position 487: ordinal not in range(128)
See log file for more details.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/barman/cli.py", line 1123, in main
    p.dispatch(pre_call=global_config)
  File "/usr/lib/python2.7/dist-packages/argh/helpers.py", line 53, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/argh/dispatching.py", line 125, in dispatch
    for line in lines:
  File "/usr/lib/python2.7/dist-packages/argh/dispatching.py", line 202, in _execute_command
    for line in result:
  File "/usr/lib/python2.7/dist-packages/argh/dispatching.py", line 158, in _call
    result = args.function(args)
  File "/usr/lib/python2.7/dist-packages/barman/cli.py", line 215, in backup
    server.backup()
  File "/usr/lib/python2.7/dist-packages/barman/server.py", line 989, in backup
    self.backup_manager.backup()
  File "/usr/lib/python2.7/dist-packages/barman/backup.py", line 369, in backup
    msg_lines = str(e).strip().splitlines()
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 487: ordinal not in range(128)

I found a solution here:
https://groups.google.com/forum/#!topic/pgbarman/vRWoixLYrqE

On a Debian system I had to edit /usr/lib/python2.7/dist-packages/barman/cli.py

and change def main() like so:

def main():
    """
    The main method of Barman
    """

    reload(sys)
    sys.setdefaultencoding('utf8')

Please paste this fix into the sources.

Discussion

  • Marco Nenciarini

    • status: open --> closed
     
  • Marco Nenciarini

    The issue has been fixed in several commits that improved the handling of decoding errors.

    Please consider that the workaround proposed, that may work in some cases, isn ugly hack that breacks several assumptions in the python interpreter and may introduce more errors.

    If you find any decoded error, please report it, so we can update the barman code to be resilient to encoding errors.

     

Log in to post a comment.

MongoDB Logo MongoDB