Bug 1809631 - dbus_init() hangs when called in a script that calls another instance via sudo --preserve-env
Summary: dbus_init() hangs when called in a script that calls another instance via sud...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-jeepney
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Göran Uddeborg
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-03 15:02 UTC by Alex Schultz
Modified: 2020-03-16 20:33 UTC (History)
9 users (show)

Fixed In Version: python-jeepney-0.4.3-1.fc31 python-jeepney-0.4.3-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-14 00:36:34 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github mitya57 secretstorage issues 22 0 None open dbus_init() hangs when called in a script that calls another instance via sudo --preserve-env 2020-03-03 15:02:20 UTC
Gitlab takluyver/jeepney/-/merge_requests/13/ 0 None None None 2020-03-04 15:32:26 UTC
Gitlab takluyver/jeepney/issues/10 0 None None None 2020-03-03 16:21:26 UTC

Description Alex Schultz 2020-03-03 15:02:21 UTC
Description of problem:
In the CentOS8 version of this package, the process hangs if a script that performs a dbus_init() calls another script that perfoms a dbus_init() with sudo --preserve-env.  On fedora 31, the second process fails with a connection reset by peer. In previous versions (2.x) this succeeds.  The problem being that performing an 'import keyring' in two scripts triggers this scenario. I'm uncertain if this a jeepney problem or a secretstorage problem but i'm starting with this package.



Version-Release number of selected component (if applicable):
python3-secretstorage-3.1.1-2.fc31.noarch
python3-jeepney-0.4.2-1.fc31.noarch

python3-secretstorage-3.1.1-4.el8.noarch
python3-jeepney-0.4.1-1.el8.noarch

How reproducible:


Steps to Reproduce:
1. Using the scripts from the attached upstream issue
2. run ./a.py
3.

Actual results:
a main()
a launch()
a dbus_init()
a subprocess
b main()
b launch()
b dbus_init()
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/secretstorage/__init__.py", line 37, in dbus_init
    connection = connect_and_authenticate()
  File "/usr/lib/python3.7/site-packages/jeepney/integrate/blocking.py", line 106, in connect_and_authenticate
    auth_parser.feed(sock.recv(1024))
ConnectionResetError: [Errno 104] Connection reset by peer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/aschultz/Documents/workspace/misc/secretstorage/b.py", line 9, in launch
    bus = secretstorage.dbus_init()
  File "/usr/lib/python3.7/site-packages/secretstorage/__init__.py", line 45, in dbus_init
    raise SecretServiceNotAvailableException(str(ex)) from ex
secretstorage.exceptions.SecretServiceNotAvailableException: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aschultz/Documents/workspace/misc/secretstorage/b.py", line 17, in <module>
    launch()
  File "/home/aschultz/Documents/workspace/misc/secretstorage/b.py", line 11, in launch
    raise RuntimeError("Unable to initialize SecretService: %s" % e)
RuntimeError: Unable to initialize SecretService: [Errno 104] Connection reset by peer
a exception
Traceback (most recent call last):
  File "./a.py", line 28, in <module>
    launch()
  File "./a.py", line 20, in launch
    subprocess.check_call(cmd)
  File "/usr/lib64/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '--preserve-env', 'python3', '/home/aschultz/Documents/workspace/misc/secretstorage/b.py']' returned non-zero exit status 1.


Expected results:
The second script should succeed.

Additional info:

Comment 1 wes hayutin 2020-03-03 15:35:04 UTC
raising the severity and priority as it's blocking openstack on centos-8

Comment 2 Miro Hrončok 2020-03-03 15:42:37 UTC
Where is python3-secretstorage-3.1.1-4.el8 from?

Comment 3 Alex Schultz 2020-03-03 16:02:38 UTC
It's a rebuild of the fedora package for RDO

Comment 4 Alex Schultz 2020-03-03 16:21:26 UTC
Per the issue reported against secretstorage, I've also opened an issue against jeepney.

Comment 6 Miro Hrončok 2020-03-03 17:26:43 UTC
> It's a rebuild of the fedora package for RDO

Oh, I see. Let's continue the discussion upstream and then backport the fix once available either to jeepney or here?

Comment 9 Thomas Kluyver 2020-03-04 10:36:09 UTC
Hi, Jeepney maintainer here. I believe there are two parts to this.

1. Raising an error instead of hanging, which seems to be platform-dependent. My proposed fix for Jeepney is here: https://gitlab.com/takluyver/jeepney/-/merge_requests/13/diffs

2. Correctly handling that error so 'import keyring' doesn't fail. I believe this needs to be fixed in keyring - and it works for me, so maybe it already has been?

Comment 10 Alex Schultz 2020-03-04 15:32:27 UTC
Changing the component as we've identified this as an issue with jeepney. There is a proposed patch so we just need to make sure this makes its way in to the packaging once merged & released.

Comment 11 Fedora Update System 2020-03-05 19:36:20 UTC
python-jeepney-0.4.3-1.fc32 has been pushed to the Fedora 32 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-25c1929a44

Comment 12 Fedora Update System 2020-03-06 03:39:03 UTC
python-jeepney-0.4.3-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a9aa44de1

Comment 13 Fedora Update System 2020-03-14 00:36:34 UTC
python-jeepney-0.4.3-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2020-03-16 20:22:44 UTC
python-jeepney-0.4.3-1.fc32 has been pushed to the Fedora 32 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2020-03-16 20:33:37 UTC
python-jeepney-0.4.3-1.fc32 has been pushed to the Fedora 32 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.