Bug 923418 - emacs starts up slow if hostname is invalid DNS name
Summary: emacs starts up slow if hostname is invalid DNS name
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 19
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Petr Hracek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2013-03-19 19:10 UTC by Christopher Beland
Modified: 2016-04-18 08:59 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-07-30 12:43:21 UTC
Type: Bug

Attachments (Terms of Use)
strace -o output.txt emacs -nw (161.92 KB, text/plain)
2014-04-10 00:36 UTC, patrick korsnick
no flags Details

Description Christopher Beland 2013-03-19 19:10:14 UTC
When running "emacs filename" while su'd to root from a non-root account, I get the following error on my terminal:

(emacs:5199): GLib-WARNING **: In call to g_spawn_sync(), exit status of a child process was requested but SIGCHLD action was set to SIG_IGN and ECHILD was received by waitpid(), so exit status can't be returned. This is a bug in the program calling g_spawn_sync(); either don't request the exit status, or don't set the SIGCHLD action.

Emacs also takes several seconds to appear, which seems slower than it should be; not sure if that is related.


Comment 1 Petr Hracek 2013-03-21 07:56:10 UTC
I have tried to simulate that problem but without success.

Please describe me how to reproduce that problem?

Comment 2 Christopher Beland 2013-03-23 15:54:23 UTC
Hmm, I cannot reproduce using the same steps I used before; perhaps there is something else that needs to happen to cause this.  I also occasionally see slow startup when starting from the Gnome Shell favorites list.  I expect this error is being output, but I don't see a ~/.xsession-errors.  Is that still where output from GUI apps gets recorded?  I will be on the lookout for this and see if I can isolate the trigger.

Comment 3 Christopher Beland 2013-07-18 20:17:06 UTC
Currently running emacs-24.2-19.fc18.x86_64.  Today this is happening when just running "emacs FILENAME" on the command line for a regular user.  Emacs uses very little CPU while I am waiting for it to appear, and it does not appear to be in disk-wait according to "top".

Comment 4 Christopher Beland 2013-07-18 20:49:37 UTC
(And I do not see any error/warning output.)

Comment 5 Christopher Beland 2013-07-31 18:21:09 UTC
I discovered today that having the network plugged in makes a critical difference.  With no network, Emacs starts up nearly instantly.  After plugging in an Ethernet cable and waiting 10 seconds after the connection is established, Emacs takes 5-15 seconds to start up, even when invoked in exactly the same way.

Comment 6 Christopher Beland 2013-07-31 20:16:45 UTC
Finally figured out how to reproduce this problem!  It is happening because something is making DNS requests for my hostname.  But when the contents of /etc/hostname are not a valid DNS name, it takes a few seconds for the DNS query to fail.  Emacs startup hangs while it's waiting for that to happen.

I can solve this problem by adding an entry for my hostname in /etc/hosts, under

Testing today with emacs-24.3-9.fc19.x86_64, confirming this is still a problem on Fedora 19.

Comment 7 Eric Hanchrow 2014-03-11 18:31:34 UTC
I can confirm Christopher's observations: on CentOS 6.5, with emacs-nox.x86_64        1:23.1-25.el6, emacs indeed started up slowly, but when I added my hostname to /etc/hosts, it starts quickly.

Comment 8 patrick korsnick 2014-04-10 00:34:12 UTC
I can confirm this on fedora 20 as of today. Adding the hostname to the localhost line of /etc/hosts gets rid of the laggy start time. I'm attaching and strace from when it takes a long time to start (hostname *not* it /etc/hosts).

Comment 9 patrick korsnick 2014-04-10 00:36:23 UTC
Created attachment 884686 [details]
strace -o output.txt emacs -nw

This strace was generated with a completely fresh f20 x64 install- no yum update. just yum install emacs after install. No .emacs either.

Behaves the same if I do a yum update to today's current stuff also.

Comment 10 David Poetzsch-Heffter 2014-07-14 11:15:23 UTC
I can also confirm this bug for the current version of fedora 20. The fix also works for me.

Comment 11 Petr Hracek 2014-07-14 11:36:03 UTC
I think that this is not an emacs bug.

Emacs will not modify /etc/hosts file at all.
Should emacs check whether DNS name is valid or not?

I think that the question is for upstream.
I will open the issue for this case.

Comment 12 Petr Hracek 2014-07-29 07:31:03 UTC
The issue was address to upstream

But from my point of view this is not emacs bug.

Comment 13 Petr Hracek 2014-07-30 12:43:21 UTC
This issue wouldn't be handled by emacs upstream.
Therefore closing the bug as NOTABUG.

Comment 14 BugMasta 2016-04-18 08:59:58 UTC

Note You need to log in before you can comment on or make changes to this bug.