Regression: g_socket_client_connect_to_host_async() sometimes gets "Connection refused" when connecting to localhost
Cockpit's unit tests started to fail in Fedora Rawhide, due to a regression in glib 2.59.x. 2.58.3 is still fine:
cockpit-protocol:ERROR:src/common/test-webserver.c:353:perform_http_request: assertion failed (error == NULL): Could not connect to localhost: Connection refused (g-io-error-quark, 39) FAIL: test-webserver 12 /web-server/local-address-only
The unit test essentially tries this:
GSocketClient *client = g_socket_client_new () g_socket_client_connect_to_host_async (client, "localhost:12345", 1, NULL, on_ready_get_result, &result); while (result == NULL) g_main_context_iteration (NULL, TRUE); conn = g_socket_client_connect_to_host_finish (client, result, &error);
where 12345 is a random local port.
I. e. sometimes
g_socket_client_connect_to_host_async() fails with "Connection refused" even though the server is reachable.
I ran a bisect:
- latest known good: af39a373
- definitively bad: gnetworkaddress: Interleave ipv4 and ipv6 addresses
- There are two commits in between: gsocketclient: Improve handling of slow initial connections and gnetworkaddress: Implement parallel ipv4 and ipv6 dns lookups; I can't test these as they cause immediate segfaults
I don't have a standalone reproducer yet. Maybe @pgriffis has some idea what goes wrong here?