Bug 923418

Summary: emacs starts up slow if hostname is invalid DNS name
Product: [Fedora] Fedora Reporter: Christopher Beland <beland>
Component: emacsAssignee: Petr Hracek <phracek>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: davidpoetzsch, javiermon, jonathan.underwood, korsnick, phracek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-30 12:43:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
strace -o output.txt emacs -nw none

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.

Version:
emacs-24.2-6.fc18.x86_64
glib2-2.34.2-2.fc18.x86_64

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 127.0.0.1.

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
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18142

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 Comment hidden (spam)