Bug 2074587

Summary: Launching GTK4 apps on beta 36 doesn't work at all because of a deadlock in opencryptoki when called from gst-plugin-scanner.
Product: [Fedora] Fedora Reporter: Emilio Cobos Álvarez (:emilio) <emilio>
Component: opencryptokiAssignee: Dan Horák <dan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: bdpepple, dan, emilio, ksinny, mschmidt, uraeus, wtaymans
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: opencryptoki-3.17.0-7.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-07 04:27:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Stack of the scanner process
none
Stack of gtk4-widget-factory. none

Description Emilio Cobos Álvarez (:emilio) 2022-04-12 14:58:38 UTC
Description of problem:

Trying to launch any GTK4 app (from something that isn't a flatpak), like:

$ gtk4-widget-factory

or:

$ rhythmbox

Seems to hang. Here's the output of running gtk4-widget-factory:

```
$ gtk4-widget-factory                                                                                                                                                                                                                      

(gst-plugin-scanner:253066): GLib-GObject-WARNING **: 16:51:12.083: type name '-a-png-encoder-pred' contains invalid characters

(gst-plugin-scanner:253066): GLib-GObject-CRITICAL **: 16:51:12.083: g_type_set_qdata: assertion 'node != NULL' failed

(gst-plugin-scanner:253066): GLib-GObject-CRITICAL **: 16:51:12.083: g_type_set_qdata: assertion 'node != NULL' failed

(gst-plugin-scanner:253066): GLib-GObject-WARNING **: 16:51:12.108: type name '-a-png-encoder-pred' contains invalid characters

(gst-plugin-scanner:253066): GLib-GObject-CRITICAL **: 16:51:12.108: g_type_set_qdata: assertion 'node != NULL' failed

(gst-plugin-scanner:253066): GLib-GObject-CRITICAL **: 16:51:12.108: g_type_set_qdata: assertion 'node != NULL' failed
```

ps shows that there's a process like this:

  /usr/libexec/gstreamer-1.0/gst-plugin-scanner -l /usr/bin/gtk4-widget-factory

Running as a child of gtk4-widget-factory.

Version-Release number of selected component (if applicable): gstreamer1-1.20.0-1.fc36.x86_64

How reproducible: Always


Steps to Reproduce:
1. Launch gtk4 app

Actual results: Hang

Expected results: No hang

Comment 1 Emilio Cobos Álvarez (:emilio) 2022-04-12 14:59:36 UTC
Created attachment 1871988 [details]
Stack of the scanner process

Seems dead-locked.

Comment 2 Emilio Cobos Álvarez (:emilio) 2022-04-12 15:00:26 UTC
Created attachment 1871989 [details]
Stack of gtk4-widget-factory.

For reference.

Comment 3 Emilio Cobos Álvarez (:emilio) 2022-04-12 15:35:25 UTC
check_user_and_group() fails and leaves the mutex locked, so if another module tries to load later it deadlocks.

Comment 4 Emilio Cobos Álvarez (:emilio) 2022-04-12 15:47:58 UTC
https://github.com/opencryptoki/opencryptoki/commit/3fea29baa97be9c132a8189eb00c7a782900d472 is the fix, apparently, took a bit to track down. It'd be nice to get that into the Fedora 36 release. Of course locally I can just add myself to the right group.

Comment 5 Emilio Cobos Álvarez (:emilio) 2022-04-12 15:52:35 UTC
sudo usermod -a -G pkcs11 $(whoami)

fixed it, as expected. Kinda nasty, I had to fix my debugger to diagnose it (https://github.com/rr-debugger/rr/pull/3140) :-)

Presumably doesn't affect all gtk4 apps, only those that use gstreamer.

Comment 6 Fedora Update System 2022-04-20 08:46:31 UTC
FEDORA-2022-158ea10931 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-158ea10931

Comment 7 Fedora Update System 2022-04-20 15:31:04 UTC
FEDORA-2022-158ea10931 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-158ea10931`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-158ea10931

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-05-07 04:27:59 UTC
FEDORA-2022-158ea10931 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.