borg icon indicating copy to clipboard operation
borg copied to clipboard

sys.excepthook-related RuntimeWarning by trio / pyfuse3

Open solracsf opened this issue 3 years ago • 17 comments

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes, searched for "RuntimeWarning", no similar results

Is this a BUG / ISSUE report or a QUESTION?

Bug

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

borg 1.2.0 + Python 3.8.10

Operating system (distribution) and version.

Ubuntu 20.04.3

Full borg commandline that lead to the problem (leave away excludes and passwords)

# borg -V
/usr/lib/python3/dist-packages/trio/_core/_multierror.py:468: RuntimeWarning: You seem to already have a custom sys.excepthook handler installed. I'll skip installing Trio's custom handler, but this means MultiErrors will not show full tracebacks.
  warnings.warn(
borg 1.2.0

solracsf avatar Feb 24 '22 10:02 solracsf

Looks like this is an warning from trio, which is used by pyfuse3.

Not sure where the custom sys.excepthook comes from, but I search the borg source code: it is not from us.

Maybe it is specific to the pyinstaller-made binary (do you use the binary or how did you install borg?).

You could also maybe use llfuse and fuse 2, see the borg docs. Or just ignore it, it is just a warning, not an error.

ThomasWaldmann avatar Feb 24 '22 18:02 ThomasWaldmann

I'm also using Borgmatic. Could this be the source?

solracsf avatar Feb 24 '22 19:02 solracsf

I don't know the borgmatic details, but I guess it just calls borg as a subprocess, so there shouldn't be an influence.

ThomasWaldmann avatar Feb 24 '22 20:02 ThomasWaldmann

This is related to one of these, check this:

root@fsn:~# borg -V
borg 1.1.17

then

root@fsn# apt update && apt upgrade
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:3 http://ppa.launchpad.net/costamagnagianfranco/borgbackup/ubuntu focal InRelease
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Fetched 336 kB in 2s (205 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libb2-1
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  libfuse3-3 libxxhash0 python3-async-generator python3-msgpack python3-outcome python3-pyfuse3 python3-sniffio
  python3-sortedcontainers python3-trio
The following packages will be upgraded:
  borgbackup
1 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,441 kB of archives.
After this operation, 3,202 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-msgpack amd64 0.6.2-1 [73.5 kB]
Get:2 http://ppa.launchpad.net/costamagnagianfranco/borgbackup/ubuntu focal/main amd64 libxxhash0 amd64 0.8.1-1~ubuntu20.04.1~ppa1             [25.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/universe amd64 libfuse3-3 amd64 3.9.0-2 [74.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-async-generator all 1.10-2 [17.5 kB]
Get:5 http://ppa.launchpad.net/costamagnagianfranco/borgbackup/ubuntu focal/main amd64 borgbackup amd64 1.2.0-1~ubuntu20.04.1~ppa1             [794 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-outcome all 1.0.1-1 [5,924 B]
Get:7 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-sniffio all 1.1.0-1 [6,268 B]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-sortedcontainers all 2.1.0-2 [27.3 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 python3-trio all 0.13.0-2 [213 kB]
Get:10 http://ppa.launchpad.net/costamagnagianfranco/borgbackup/ubuntu focal/main amd64 python3-pyfuse3 amd64 3.2.0-3~ubuntu20.04.            1~ppa1 [204 kB]
Fetched 1,441 kB in 1s (2,517 kB/s)
Selecting previously unselected package python3-msgpack.
(Reading database ... 45843 files and directories currently installed.)
Preparing to unpack .../0-python3-msgpack_0.6.2-1_amd64.deb ...
Unpacking python3-msgpack (0.6.2-1) ...
Selecting previously unselected package libxxhash0:amd64.
Preparing to unpack .../1-libxxhash0_0.8.1-1~ubuntu20.04.1~ppa1_amd64.deb ...
Unpacking libxxhash0:amd64 (0.8.1-1~ubuntu20.04.1~ppa1) ...
Preparing to unpack .../2-borgbackup_1.2.0-1~ubuntu20.04.1~ppa1_amd64.deb ...
Unpacking borgbackup (1.2.0-1~ubuntu20.04.1~ppa1) over (1.1.17-2~ubuntu20.04.1~ppa1) ...
Selecting previously unselected package libfuse3-3:amd64.
Preparing to unpack .../3-libfuse3-3_3.9.0-2_amd64.deb ...
Unpacking libfuse3-3:amd64 (3.9.0-2) ...
Selecting previously unselected package python3-async-generator.
Preparing to unpack .../4-python3-async-generator_1.10-2_all.deb ...
Unpacking python3-async-generator (1.10-2) ...
Selecting previously unselected package python3-outcome.
Preparing to unpack .../5-python3-outcome_1.0.1-1_all.deb ...
Unpacking python3-outcome (1.0.1-1) ...
Selecting previously unselected package python3-sniffio.
Preparing to unpack .../6-python3-sniffio_1.1.0-1_all.deb ...
Unpacking python3-sniffio (1.1.0-1) ...
Selecting previously unselected package python3-sortedcontainers.
Preparing to unpack .../7-python3-sortedcontainers_2.1.0-2_all.deb ...
Unpacking python3-sortedcontainers (2.1.0-2) ...
Selecting previously unselected package python3-trio.
Preparing to unpack .../8-python3-trio_0.13.0-2_all.deb ...
Unpacking python3-trio (0.13.0-2) ...
Selecting previously unselected package python3-pyfuse3.
Preparing to unpack .../9-python3-pyfuse3_3.2.0-3~ubuntu20.04.1~ppa1_amd64.deb ...
Unpacking python3-pyfuse3 (3.2.0-3~ubuntu20.04.1~ppa1) ...
Setting up python3-sniffio (1.1.0-1) ...
Setting up python3-outcome (1.0.1-1) ...
Setting up python3-async-generator (1.10-2) ...
Setting up python3-sortedcontainers (2.1.0-2) ...
Setting up python3-trio (0.13.0-2) ...
Setting up libfuse3-3:amd64 (3.9.0-2) ...########################################################.............................]
Setting up libxxhash0:amd64 (0.8.1-1~ubuntu20.04.1~ppa1) ...##########################################........................]
Setting up python3-msgpack (0.6.2-1) ...###################################################################...................]
Setting up python3-pyfuse3 (3.2.0-3~ubuntu20.04.1~ppa1) ...#####################################################..............]
Setting up borgbackup (1.2.0-1~ubuntu20.04.1~ppa1) ...################################################################........]
Processing triggers for man-db (2.9.1-1) ...###############################################################################...]
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

then again

root@fsn:~# borg -V
/usr/lib/python3/dist-packages/trio/_core/_multierror.py:468: RuntimeWarning: You seem to already have a custom sys.excepthook handler installed. I'll skip installing Trio's custom handler, but this means MultiErrors will not show full tracebacks.
  warnings.warn(
borg 1.2.0

Related https://github.com/python-trio/trio/issues/1553

solracsf avatar Feb 24 '22 21:02 solracsf

try print(sys.excepthook) or so to see what's in it.

ThomasWaldmann avatar Feb 25 '22 11:02 ThomasWaldmann

I'm getting the same warning and I'm not using borgmatic, but the same Ubuntu PPA on 20.04.

>>> import sys
>>> print(sys.excepthook)
<function apport_excepthook at 0x7fd7b9a39d30>
>>>

So, it seems to be coming from apport/Ubuntu's Python distribution itself. Theoretically, that behavior can be reverted, just not sure where it should be added.

Maxr1998 avatar Feb 26 '22 00:02 Maxr1998

Currently we just know that there is this unpretty warning.

We do not know yet whether there is an actual problem or whether we prefer trio's custom handler over apport's handler.

Depending on that, possible solutions:

  • trying to get rid of apport's handler
  • trying to disable the warning
  • live with it

ThomasWaldmann avatar Feb 26 '22 13:02 ThomasWaldmann

Hi,

Just to add my experience here.

I have two Ubuntu 20.04.4 servers with the same configuration:

borgbackup 1.2.0
borgmatic 1.5.23
Python 3.8.10

I only have the problem with one server.

The only differences I have is regarding the packages installed via PIP.

++

EDIT: uninstalling 'pyfuse3' clear the problem, not even sure why I have it installed....

jpoggi avatar Mar 03 '22 18:03 jpoggi

@jpoggi If you want borg mount working (on the borg client side), you either need llfuse (fuse2) or pyfuse3 (fuse3).

ThomasWaldmann avatar Mar 03 '22 18:03 ThomasWaldmann

@ThomasWaldmann ok thanks for the information, I do not use borg mount.

jpoggi avatar Mar 03 '22 18:03 jpoggi

This seems to be related to an outdated version of trio https://github.com/python-trio/trio/issues/1994

python3 -m pip install -U trio fixed it on my side (Ubuntu 20.04), which upgrades python-trio from 0.13 to 0.20, no more warnings after this upgrade.

Maybe a specific version >0.13 should be pinned. See https://github.com/python-trio/trio/issues/1

solracsf avatar Mar 11 '22 23:03 solracsf

@solracsf the first link points to an unrelated issue. although it contains the same warning, the issue is about that AttributeError, not about the warning.

But as you say the warning goes away with newer trio, maybe they also have fixed something there. Can you find out the minimum version that makes the warning go away? And can you reproduce by downgrading to previous release of that, making the warning reappear?

Requiring a specific trio version is not in scope of borgbackup though, this should be done within the https://github.com/libfuse/pyfuse3 project, so maybe file an issue there.

ThomasWaldmann avatar Mar 12 '22 17:03 ThomasWaldmann

I can confirm, upgrading trio to 0.20.0 does fix it

kzshantonu avatar Mar 19 '22 01:03 kzshantonu

This is happening on Ubuntu 22.10 as well, with python3-trio system package (0.21.0-1) and borg 1.22

I'm not sure when it got installed, but I don't have anything of substance that uses the library, at least nothing that installed via apt.

~ sudo apt autoremove --purge python3-trio
[sudo] password for luis: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED
  python3-async-generator* python3-attr* python3-outcome* python3-pyfuse3* python3-sortedcontainers* python3-trio*
0 to upgrade, 0 to newly install, 6 to remove and 3 not to upgrade.
After this operation, 2,380 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 724924 files and directories currently installed.)
Removing python3-pyfuse3 (3.2.1-1) ...
Removing python3-trio (0.21.0-1) ...
Removing python3-async-generator (1.10-3) ...
Removing python3-outcome (1.2.0-1) ...
Removing python3-attr (22.1.0-1) ...
Removing python3-sortedcontainers (2.4.0-2) ...

~

Removing the library altogether gets rid of the warning.

luispabon avatar Oct 06 '22 09:10 luispabon

@luispabon for borg you either need llfuse or pyfuse3 (and pyfuse3 needs trio) - at least if you want to use borg mount, which requires them.

If you do not use borg mount, the rest of borg will also work without them.

ThomasWaldmann avatar Oct 06 '22 09:10 ThomasWaldmann

Thanks for the heads up 👍🏽 I don't use this feature, I personally back up to a folder within my devices then rsync into an s3 bucket afterwards which works pretty well for me.

luispabon avatar Oct 06 '22 09:10 luispabon

I confirm this using the following process on an Ubuntu 20.04 LTS:

# install without ppa
sudo apt-get install borgbcakup

# this shows 1.1.5
borg --version

# add ppa
sudo add-apt-repository ppa:costamagnagianfranco/borgbackup
sudo apt update

# install borg from ppa
sudo apt-get install borgbackup

# this shows the warning and 1.2.4
borg --version

cherouvim avatar Sep 08 '23 09:09 cherouvim