All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dbus-display: fix test race when initializing p2p connection
@ 2022-06-09 15:26 marcandre.lureau
  2022-06-11 20:21 ` Cole Robinson
  0 siblings, 1 reply; 2+ messages in thread
From: marcandre.lureau @ 2022-06-09 15:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: crobinso, Marc-André Lureau, Gerd Hoffmann

From: Marc-André Lureau <marcandre.lureau@redhat.com>

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>
---
 ui/dbus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/dbus.c b/ui/dbus.c
index 7a87612379e8..70dd4be210e4 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -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);
 }
 
 
@@ -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,
-- 
2.36.0.44.g0f828332d5ac



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dbus-display: fix test race when initializing p2p connection
  2022-06-09 15:26 [PATCH] dbus-display: fix test race when initializing p2p connection marcandre.lureau
@ 2022-06-11 20:21 ` Cole Robinson
  0 siblings, 0 replies; 2+ messages in thread
From: Cole Robinson @ 2022-06-11 20:21 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel; +Cc: Gerd Hoffmann

On 6/9/22 11:26 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 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>
> ---
>  ui/dbus.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Fedora test build passed for me. Thanks Marc-André!

Tested-by: Cole Robinson <crobinso@redhat.com>

- Cole



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-11 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 15:26 [PATCH] dbus-display: fix test race when initializing p2p connection marcandre.lureau
2022-06-11 20:21 ` Cole Robinson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.