Skip to content

Commit

Permalink
dbus-display: fix test race when initializing p2p connection
Browse files Browse the repository at this point in the history
The D-Bus connection starts processing messages before QEMU has the time
to set the object manager server. This is causing dbus-display-test to
fail randomly with:

ERROR:../tests/qtest/dbus-display-test.c:68:test_dbus_display_vm:
assertion failed
(qemu_dbus_display1_vm_get_name(QEMU_DBUS_DISPLAY1_VM(vm)) ==
"dbus-test"): (NULL == "dbus-test") ERROR

Use the delayed message processing flag and method to avoid that
situation.

(the bus connection doesn't need a fix, as the initialization is done
synchronously)

Reported-by: Robinson, Cole <crobinso@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
Message-Id: <20220609152647.870373-1-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
elmarco authored and kraxel committed Jul 19, 2022
1 parent 7823789 commit c8ddcdd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/dbus.c
Expand Up @@ -268,6 +268,7 @@ dbus_display_add_client_ready(GObject *source_object,
}

g_dbus_object_manager_server_set_connection(dbus_display->server, conn);
g_dbus_connection_start_message_processing(conn);
}


Expand Down Expand Up @@ -300,7 +301,8 @@ dbus_display_add_client(int csock, Error **errp)

g_dbus_connection_new(G_IO_STREAM(conn),
guid,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING,
NULL,
dbus_display->add_client_cancellable,
dbus_display_add_client_ready,
Expand Down

0 comments on commit c8ddcdd

Please sign in to comment.