Bug 1825230

Summary: Crash in GCancellable when closing GDBus connection
Product: [Fedora] Fedora Reporter: Beniamino Galvani <bgalvani>
Component: glib2Assignee: Matthias Clasen <mclasen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: caillon+fedoraproject, gnome-sig, john.j5live, mclasen, rhughes, rstrode, sandmann, tiagomatos, vbenes
Target Milestone: ---Keywords: AutomationBlocker, EasyFix, Patch, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glib2-2.64.2-2.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-01 00:36:32 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:

Description Beniamino Galvani 2020-04-17 12:47:35 UTC
There is a frequent crash of nmcli during NetworkManager build
tests. Glib crashes in the following way when disposing a GDBus
connection:

 Core was generated by `/root/NetworkManager/clients/cli/.libs/lt-nmcli --mode multiline --terse --colo'.
 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x00007f66dfdc7067 in g_source_set_ready_time (source=0x7f66d407f800, ready_time=0) at ../glib/gmain.c:1942
 1942     if (source->priv->ready_time == ready_time)

 (gdb) backtrace
 #0  0x00007f66dfdc7067 in g_source_set_ready_time (source=0x7f66d407f800, ready_time=0) at ../glib/gmain.c:1942
 #1  0x00007f66dff56d2a in cancellable_source_cancelled (cancellable=<optimized out>, user_data=0x7f66d407f800) at ../gio/gcancellable.c:666
 #2  0x00007f66dfebaaf6 in _g_closure_invoke_va
     (closure=closure@entry=0x7f66d407ff30, return_value=return_value@entry=0x0, instance=instance@entry=0x1cebf60, args=args@entry=0x7ffde0e4ccb0, n_params=0, param_types=0x0)
     at ../gobject/gclosure.c:873
 #3  0x00007f66dfed3813 in g_signal_emit_valist (instance=0x1cebf60, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7ffde0e4ccb0) at ../gobject/gsignal.c:3407
 #4  0x00007f66dfed3d93 in g_signal_emit (instance=instance@entry=0x1cebf60, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3554
 #5  0x00007f66dff5742e in g_cancellable_cancel (cancellable=0x1cebf60 [GCancellable]) at ../gio/gcancellable.c:509
 #6  0x00007f66e0026ee9 in _g_dbus_worker_close (worker=0x7f66d000e7f0, task=<optimized out>) at ../gio/gdbusprivate.c:1721
 #7  0x00007f66e0026f27 in _g_dbus_worker_stop (worker=0x7f66d000e7f0) at ../gio/gdbusprivate.c:1742
 #8  0x00007f66e0012069 in g_dbus_connection_dispose (object=0x1cfb0b0 [GDBusConnection]) at ../gio/gdbusconnection.c:613
 #9  0x00007f66dfebfd18 in g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3461
 #10 g_object_unref (_object=0x1cfb0b0) at ../gobject/gobject.c:3391
 #11 0x00007f66e03f93f8 in dispose (object=0x1cf4130 [NMClient]) at libnm/nm-client.c:7868
 #12 0x00007f66dfebfd18 in g_object_unref (_object=<optimized out>) at ../gobject/gobject.c:3461
 #13 g_object_unref (_object=0x1cf4130) at ../gobject/gobject.c:3391
 #14 0x0000000000419b2a in nmc_cleanup (nmc=0x4bae60 <nm_cli>) at clients/cli/nmcli.c:941
 #15 main (argc=<optimized out>, argv=<optimized out>) at clients/cli/nmcli.c:1005

 (gdb) p source
 $1 = (GSource *) 0x7f66d407f800

 (gdb) p source->priv
 $2 = (GSourcePrivate *) 0x0


Version-Release number of selected component (if applicable):
glib2-2.64.1-1.fc32


How reproducible:
Happens regularly when building NM on F32 and running 'make check'.


Additional info:
Looking at glib history, I think that backporting this commit might help:

 commit e4a690f5dd959e74b2d6054826f61509892c8aa7
 Author: Philip Withnall <withnall>
 Date:   Fri Feb 21 14:44:44 2020 +0000

 gcancellable: Fix minor race between GCancellable and GCancellableSource

 There’s a minor race condition between cancellation of a `GCancellable`,
 and disposal/finalisation of a `GCancellableSource` in another thread.

Comment 1 Tomas Popela 2020-04-17 13:11:02 UTC
Scratch build with a mentioned commit backported - https://koji.fedoraproject.org/koji/taskinfo?taskID=43490718

Comment 2 Vladimir Benes 2020-04-21 09:01:45 UTC
The patched package works well, NM compiles multiple times w/o any issue. Thank you Tomas!

Comment 3 Fedora Update System 2020-04-28 08:47:19 UTC
FEDORA-2020-5afa51912e has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-5afa51912e

Comment 4 Fedora Update System 2020-04-29 02:04:53 UTC
FEDORA-2020-5afa51912e has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-5afa51912e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-5afa51912e

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

Comment 5 Fedora Update System 2020-05-01 00:36:32 UTC
FEDORA-2020-5afa51912e has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.