After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635852 - gdbus/connection/life-cycle unit test fails sometimes
gdbus/connection/life-cycle unit test fails sometimes
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gdbus
2.26.x
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-11-26 13:47 UTC by Elmir Jagudin
Modified: 2018-05-24 12:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix for test_connection_life_cycle() unit test (624 bytes, patch)
2010-11-26 13:47 UTC, Elmir Jagudin
none Details | Review

Description Elmir Jagudin 2010-11-26 13:47:59 UTC
Created attachment 175310 [details] [review]
proposed fix for test_connection_life_cycle() unit test

Running glib unit test will sometimes fail with following error:


TEST: gdbus-connection... (pid=21321)
  /gdbus/connection/basic:                                             OK
  /gdbus/connection/life-cycle:                                        **
ERROR:/home/elmir/fmwr/P3301-lfp/libs/glib/glib/gio/tests/gdbus-connection.c:271:test_connection_life_cycle: Timed out waiting for single ref
FAIL
GTester: last random seed: R02S6152837b2e17d4bed141dc77048e192f
/bin/sh: line 1: 19787 Terminated              MALLOC_CHECK_=2 MALLOC_PERTURB_=$((${RANDOM:-256} % 256)) ../../glib/gtester --verbose memory-input-stream memory-output-stream readwrite g-file g-file-info converter-stream data-input-stream data-output-stream g-icon buffered-input-stream buffered-output-stream sleepy-stream filter-streams volumemonitor simple-async-result srvtarget contexts gsettings gschema-compile async-close-output-stream gdbus-addresses network-address gdbus-message gdbus-connection gdbus-connection-slow gdbus-names gdbus-proxy-well-known-name gdbus-introspection gdbus-threading gdbus-export gdbus-error gdbus-peer gdbus-exit-on-close gdbus-non-socket gdbus-bz627724 file live-g-file unix-fd



When the test fails, the GDBusConnection object's 'closed' signal is never emmited, and emit_closed_data_free() is never run. Thus the GDBusConnection ref-count is stuck at 2.

Probably the reason the test only fails sometimes, is that the unit test code takes differenct paths depending on threads timing. After the session_bus_down() call, the _g_assert_signal_received() will not be called if connection->closed = TRUE (gdbusconnection.c:1201) is executed before the call to g_dbus_connection_is_closed(). When the _g_assert_signal_received() is not called, the 'closed' signal is never emitted. I guess this is becouse there is no main-loop running at that point.

A call to _g_assert_signal_receive() will create and run the main-loop, thus making it possible for the signal to be emitted.

I propose to change the unit test to always make a call to _g_assert_signal_received(), and the check that connection have been closed and unrefed, see the attached patch.
Comment 1 Pacho Ramos 2011-01-24 13:47:22 UTC
I can confirm this error appears from time to time when building tests. Could upstream take a look on suggested patch to "approve" it if possible? Thanks a lot
Comment 2 GNOME Infrastructure Team 2018-05-24 12:54:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/377.