all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select)
@ 2009-05-05 21:00 Karl Tomlinson
  2011-10-05 19:02 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Tomlinson @ 2009-05-05 21:00 UTC (permalink / raw)
  To: bug-gnu-emacs

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







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select)
  2009-05-05 21:00 bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select) Karl Tomlinson
@ 2011-10-05 19:02 ` Glenn Morris
  2011-10-05 23:54   ` Karl Tomlinson
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2011-10-05 19:02 UTC (permalink / raw)
  To: Karl Tomlinson; +Cc: 3225

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select)
  2011-10-05 19:02 ` Glenn Morris
@ 2011-10-05 23:54   ` Karl Tomlinson
  2011-10-06  6:08     ` Jan D.
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Tomlinson @ 2011-10-05 23:54 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Karl Tomlinson, 3225

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select)
  2011-10-05 23:54   ` Karl Tomlinson
@ 2011-10-06  6:08     ` Jan D.
  0 siblings, 0 replies; 4+ messages in thread
From: Jan D. @ 2011-10-06  6:08 UTC (permalink / raw)
  To: Karl Tomlinson; +Cc: Karl Tomlinson, 3225

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.







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-06  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-05 21:00 bug#3225: session manager hang due to block on ice_fd (failure to check for EINTR in select) Karl Tomlinson
2011-10-05 19:02 ` Glenn Morris
2011-10-05 23:54   ` Karl Tomlinson
2011-10-06  6:08     ` Jan D.

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.