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 778754 - Slow gdk_display_get_name() on macOS Sierra
Slow gdk_display_get_name() on macOS Sierra
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-02-16 11:13 UTC by Jiri Techet
Modified: 2018-05-02 18:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jiri Techet 2017-02-16 11:13:23 UTC
After switching to macOS Sierra I (and another user) noticed that Geany whose OS X port I maintain starts significantly slower:

https://github.com/geany/geany/issues/1277

After some debugging it turns out it's the gdk_display_get_name() call which takes several seconds to complete. This function just returns [NSHost currentHost]; according to Apple documentation

https://developer.apple.com/reference/foundation/nshost/1408946-currenthost

the function can block for several seconds, depending on user's configuration. I found some more mentions of this behaviour, e.g.

http://secure.macscripter.net/viewtopic.php?id=45309

I checked with wireshark and [NSHost currentHost] sends 3 pairs (IPv4 and IPv6) MDNS (multicast DNS used by Bonjour) PTR queries for the IPv6 address and waits for response until it times out. This really isn't a good method to be called by gdk_display_get_name() which could probably return arbitrary string because unlike X11 there will never be more displays.

Interestingly, simple unix gethostname() as used in Apple's implementation of the hostname command

https://opensource.apple.com/source/shell_cmds/shell_cmds-81.1/hostname/hostname.c

returns immediately (at least for me). So I think it should be possible to just return g_get_host_name() in gdk_display_get_name() - the only difference is g_get_host_name() has ".local" suffix while [NSHost currentHost] doesn't.
Comment 1 GNOME Infrastructure Team 2018-05-02 18:05:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/758.