[glib/mcatanzaro/#2221] Fix race in socketclient-slow test
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/mcatanzaro/#2221] Fix race in socketclient-slow test
- Date: Mon, 19 Oct 2020 14:32:54 +0000 (UTC)
commit c71fc4e30d55da75d3f2ced299c0a42d8ae05f5a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Oct 19 08:57:46 2020 -0500
Fix race in socketclient-slow test
This test ensures that g_socket_client_connect_to_host_async() fails if
it is cancelled, but it's not cancelled until after 1 millisecond. Our
CI testers are hitting that race window, and Milan is able to reproduce
the crash locally as well. Switching it from 1ms to 0ms is enough to
avoid the crash, but let's be extra-cautious and use G_PRIORITY_HIGH
as well, for good measure.
This was discovered in #2221, but sadly it's not enough to resolve that
issue.
gio/tests/gsocketclient-slow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/tests/gsocketclient-slow.c b/gio/tests/gsocketclient-slow.c
index 34410f4cf..5d5a5c38f 100644
--- a/gio/tests/gsocketclient-slow.c
+++ b/gio/tests/gsocketclient-slow.c
@@ -124,7 +124,7 @@ test_happy_eyeballs_cancel_delayed (void)
client = g_socket_client_new ();
cancel = g_cancellable_new ();
g_socket_client_connect_to_host_async (client, "localhost", port, cancel, on_connected_cancelled, loop);
- g_timeout_add (1, (GSourceFunc) on_timer, cancel);
+ g_timeout_add_full (G_PRIORITY_HIGH, 0, (GSourceFunc) on_timer, cancel, NULL);
g_signal_connect (client, "event", G_CALLBACK (on_event), &got_completed_event);
g_main_loop_run (loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]