GNU bug report logs - #3225
session manager hang due to block on ice_fd (failure to check for EINTR in select)

Previous Next

Package: emacs;

Reported by: Karl Tomlinson <bugs+emacs <at> karlt.net>

Date: Tue, 5 May 2009 21:10:04 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3225 in the body.
You can then email your comments to 3225 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3225; Package emacs. (Tue, 05 May 2009 21:10:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Karl Tomlinson <bugs+emacs <at> karlt.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 05 May 2009 21:10:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Karl Tomlinson <bugs+emacs <at> karlt.net>
To: bug-gnu-emacs <at> gnu.org
Subject: session manager hang due to block on ice_fd (failure to check for EINTR in select)
Date: Wed, 06 May 2009 09:00:49 +1200
x_session_check_input in xmsfns.c has this code:

  if (select (ice_fd+1, &read_fds,
              (SELECT_TYPE *)0, (SELECT_TYPE *)0, &tmout) < 0)
    {
      ice_fd = -1;
      return 0;
    }

So ice_fd is set to -1 when select returns due to a signal
(with errno == EINTR).  This leaves the fd open but prevents
further processing.

ksmserver then blocks on this connection and so other apps opening
an ICE connection also block during start-up.

The simple solution that I have tested is to only set ice_fd to -1
when errno != EINTR.  x_session_check_input can still return early
in this situation as it will be called again in the future.

(Perhaps ice_fd never needs to be set to -1 here.  I don't know if
there is ever a good reason why is should be set to -1.)


In GNU Emacs 22.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2009-01-16 on blackhawk
Windowing system distributor `The X.Org Foundation', version 11.0.10503000
configured using `configure  '--prefix=/usr' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-22' '--infodir=/usr/share/info/emacs-22' '--without-carbon' '--with-sound' '--with-x' '--without-toolkit-scroll-bars' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-xpm' '--with-x-toolkit=gtk' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--libdir=/usr/lib64' '--build=x86_64-pc-linux-gnu' '--enable-new-ldflags' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CFLAGS=-O2 -pipe -march=nocona -g1' 'LDFLAGS=-Wl,-O1''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_NZ.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  msb-mode: t
  minibuffer-electric-default-mode: t
  auto-image-file-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3225; Package emacs. (Wed, 05 Oct 2011 19:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 3225 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Karl Tomlinson <bugs+emacs <at> karlt.net>
Cc: 3225 <at> debbugs.gnu.org
Subject: Re: bug#3225: session manager hang due to block on ice_fd (failure to
	check for EINTR in select)
Date: Wed, 05 Oct 2011 15:02:18 -0400
Karl Tomlinson wrote:

> x_session_check_input in xmsfns.c has this code:
>
>   if (select (ice_fd+1, &read_fds,
>               (SELECT_TYPE *)0, (SELECT_TYPE *)0, &tmout) < 0)
>     {
>       ice_fd = -1;
>       return 0;
>     }
>
> So ice_fd is set to -1 when select returns due to a signal
> (with errno == EINTR).  This leaves the fd open but prevents
> further processing.
>
> ksmserver then blocks on this connection and so other apps opening
> an ICE connection also block during start-up.
>
> The simple solution that I have tested is to only set ice_fd to -1
> when errno != EINTR.  x_session_check_input can still return early
> in this situation as it will be called again in the future.
>
> (Perhaps ice_fd never needs to be set to -1 here.  I don't know if
> there is ever a good reason why is should be set to -1.)
>
>
> In GNU Emacs 22.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.11)
>  of 2009-01-16 on blackhawk


Sorry for the delay. Is this still an issue? The current code does not
look like that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3225; Package emacs. (Thu, 06 Oct 2011 00:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 3225 <at> debbugs.gnu.org (full text, mbox):

From: Karl Tomlinson <karlt <at> karlt.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Karl Tomlinson <bugs+emacs <at> karlt.net>, 3225 <at> debbugs.gnu.org
Subject: Re: bug#3225: session manager hang due to block on ice_fd (failure to
	check for EINTR in select)
Date: Thu, 06 Oct 2011 12:54:53 +1300
Glenn Morris writes:

> Karl Tomlinson wrote:
>
>> x_session_check_input in xmsfns.c has this code:
>>
>>   if (select (ice_fd+1, &read_fds,
>>               (SELECT_TYPE *)0, (SELECT_TYPE *)0, &tmout) < 0)
>>     {
>>       ice_fd = -1;
>>       return 0;
>>     }
>>
>> So ice_fd is set to -1 when select returns due to a signal
>> (with errno == EINTR).  This leaves the fd open but prevents
>> further processing.
>
> Sorry for the delay. Is this still an issue? The current code does not
> look like that.

I haven't tested, but it looks like this should be fixed by
http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/103065




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3225; Package emacs. (Thu, 06 Oct 2011 06:09:01 GMT) Full text and rfc822 format available.

Message #14 received at 3225 <at> debbugs.gnu.org (full text, mbox):

From: "Jan D." <jan.h.d <at> swipnet.se>
To: Karl Tomlinson <karlt <at> karlt.net>
Cc: Karl Tomlinson <bugs+emacs <at> karlt.net>, Glenn Morris <rgm <at> gnu.org>,
	3225 <at> debbugs.gnu.org
Subject: Re: bug#3225: session manager hang due to block on ice_fd (failure
	to check for EINTR in select)
Date: Thu, 06 Oct 2011 08:08:27 +0200
Karl Tomlinson skrev 2011-10-06 01:54:
> Glenn Morris writes:
>
>> Karl Tomlinson wrote:
>>
>>> x_session_check_input in xmsfns.c has this code:
>>>
>>>    if (select (ice_fd+1,&read_fds,
>>>                (SELECT_TYPE *)0, (SELECT_TYPE *)0,&tmout)<  0)
>>>      {
>>>        ice_fd = -1;
>>>        return 0;
>>>      }
>>>
>>> So ice_fd is set to -1 when select returns due to a signal
>>> (with errno == EINTR).  This leaves the fd open but prevents
>>> further processing.
>>
>> Sorry for the delay. Is this still an issue? The current code does not
>> look like that.
>
> I haven't tested, but it looks like this should be fixed by
> http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/103065
>

It should be.  The select call in process.c is now used and it handles 
EINTR properly.

	Jan D.






bug closed, send any further explanations to 3225 <at> debbugs.gnu.org and Karl Tomlinson <bugs+emacs <at> karlt.net> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 06 Oct 2011 06:51:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Nov 2011 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.