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 791744 - gmenumodel test sometimes fails: assertion failed (items_changed_count == 1): (0 == 1)
gmenumodel test sometimes fails: assertion failed (items_changed_count == 1):...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-12-18 17:35 UTC by Simon McVittie
Modified: 2017-12-21 10:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gmenumodel test: If something goes wrong, don't wait forever (1.73 KB, patch)
2017-12-18 17:36 UTC, Simon McVittie
committed Details | Review
gmenumodel test: Wait for the expected events to happen (2.51 KB, patch)
2017-12-18 17:37 UTC, Simon McVittie
committed Details | Review
[2.54] gmenumodel test: If something goes wrong, don't wait forever (1.67 KB, patch)
2017-12-19 12:52 UTC, Simon McVittie
committed Details | Review
[2.54] gmenumodel test: Wait for the expected events to happen (2.44 KB, patch)
2017-12-19 12:53 UTC, Simon McVittie
committed Details | Review

Description Simon McVittie 2017-12-18 17:35:24 UTC
On Debian's reproducible builds infrastructure, we've seen one of the gmenumodel tests failing like this:

1..11
# Start of gmenu tests
ok 1 /gmenu/equality
PASS: gmenumodel 1 /gmenu/equality
ok 2 /gmenu/random
PASS: gmenumodel 2 /gmenu/random
ok 3 /gmenu/attributes
PASS: gmenumodel 3 /gmenu/attributes
ok 4 /gmenu/links
PASS: gmenumodel 4 /gmenu/links
ok 5 /gmenu/mutable
PASS: gmenumodel 5 /gmenu/mutable
ok 6 /gmenu/convenience
PASS: gmenumodel 6 /gmenu/convenience
ok 7 /gmenu/menuitem
PASS: gmenumodel 7 /gmenu/menuitem
# Start of dbus tests
ok 8 /gmenu/dbus/roundtrip
PASS: gmenumodel 8 /gmenu/dbus/roundtrip
# GLib-GIO:ERROR:../../../../../gio/tests/gmenumodel.c:850:test_dbus_subscriptions: assertion failed (items_changed_count == 1): (0 == 1)
ERROR: gmenumodel - too few tests run (expected 11, got 8)
ERROR: gmenumodel - exited with status 134 (terminated by signal 6?)

This is in test /gmenu/dbus/subscriptions, which connects to the items-changed signal, appends 3 items to an empty menu, triggers a subscription to D-Bus signals, runs the main loop for 100ms, and asserts that there has been one items-changed event and the menu now has 3 items.

So this looks like some timing issue: something (another parallel build?) is slowing down the test enough that 100ms is not long enough to wait. I've asked whether the reproducible builds infrastructure builds and tests multiple packages in parallel on the same hardware.

This test should ideally wait for the expected events to happen (and optionally assert that the time elapsed is less than some arbitrary maximum) instead of waiting an arbitrary time and asserting that the expected events happened. That would often be quicker, too.

Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884661
Comment 1 Simon McVittie 2017-12-18 17:36:22 UTC
Created attachment 365712 [details] [review]
gmenumodel test: If something goes wrong, don't wait forever

I'm about to add some loops that would otherwise wait indefinitely.
Comment 2 Simon McVittie 2017-12-18 17:37:25 UTC
Created attachment 365714 [details] [review]
gmenumodel test: Wait for the expected events to happen

Previously, we waited an arbitrary 100ms or 200ms and then asserted
that the events had happened, but that might fail if the machine is
slow or heavily loaded.
                                                  
We still wait for an arbitrary time for negative tests (asserting
that no more signals are received) because we don't have any way
to do better here.
Comment 3 Philip Withnall 2017-12-18 18:51:37 UTC
Review of attachment 365712 [details] [review]:

Yup.
Comment 4 Philip Withnall 2017-12-18 18:55:15 UTC
Review of attachment 365714 [details] [review]:

Looks good, thanks.
Comment 5 Philip Withnall 2017-12-18 19:05:05 UTC
Pushed to master, thanks. Would it be useful to you if they were also backported to glib-2-54?

Attachment 365712 [details] pushed as ea159a9 - gmenumodel test: If something goes wrong, don't wait forever
Attachment 365714 [details] pushed as 8fef0a9 - gmenumodel test: Wait for the expected events to happen
Comment 6 Simon McVittie 2017-12-19 12:50:27 UTC
(In reply to Philip Withnall from comment #5)
> Pushed to master, thanks. Would it be useful to you if they were also
> backported to glib-2-54?

Yes, but the backport for the first one is non-trivial, because this test was refactored between 2.54 and 2.55 to add the peer mode. I'll attach what I used in Debian.
Comment 7 Simon McVittie 2017-12-19 12:52:57 UTC
Created attachment 365743 [details] [review]
[2.54] gmenumodel test: If something goes wrong, don't wait forever

---

Very similar to Attachment #365712 [details], but the timeout being created and destroyed is in a different function.
Comment 8 Simon McVittie 2017-12-19 12:53:38 UTC
Created attachment 365744 [details] [review]
[2.54] gmenumodel test: Wait for the expected events to happen

---

Essentially the same as Attachment #365714 [details], but patching a different function.
Comment 9 Philip Withnall 2017-12-21 10:37:39 UTC
Review of attachment 365743 [details] [review]:

OK.
Comment 10 Philip Withnall 2017-12-21 10:37:42 UTC
Review of attachment 365744 [details] [review]:

OK.
Comment 11 Philip Withnall 2017-12-21 10:51:58 UTC
Pushed to glib-2-54; thanks for the backports.