GNU bug report logs - #32426
27.0.50; Losing key bindings in threads

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Mon, 13 Aug 2018 08:41:01 UTC

Severity: normal

Merged with 25214

Found in versions 26.0.50, 27.0.50

To reply to this bug, email your comments to 32426 AT debbugs.gnu.org.

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-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 08:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Albinus <michael.albinus <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 13 Aug 2018 08:41:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Loosing key bindings in threads
Date: Mon, 13 Aug 2018 10:40:06 +0200
This is about the feature/tramp-thread-safe branch. The bug seems to be
related to the threads implementation in general; that branch is used
only because it is simpler to demonstrate.

I have two files, a.test and b.test. Both files have the same contents

--8<---------------cut here---------------start------------->8---
Local Variables:
risky-variable: nil
End:
--8<---------------cut here---------------end--------------->8---

I open both files asynchronously via "C-x & C-x C-f *.test". The buffer
*Local Variables* is displayed, and in the minibuffer I'm asked "Please
type y, n, or !, or C-v to scroll:". Whatever key I type, I get "y is
undefined".

I have no idea how to debug this.


In GNU Emacs 27.0.50 (build 18, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-18 built on detlef
Repository revision: ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.1 LTS

Recent messages:
Mark set
No more unseen articles
Mark set
No more unseen articles
No more unread articles
Returning to the group buffer
Saving /home/albinus/.newsrc.eld...
Saving file /home/albinus/.newsrc.eld...
Wrote /home/albinus/.newsrc.eld
Saving /home/albinus/.newsrc.eld...done

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8

Major mode: VC dir

Minor modes in effect:
  diff-auto-refine-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  icomplete-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/albinus/src/elpa/packages/debbugs/debbugs-org hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-org
/home/albinus/src/elpa/packages/debbugs/debbugs-gnu hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-gnu
/home/albinus/src/elpa/packages/debbugs/debbugs hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs
/home/albinus/src/elpa/packages/debbugs/debbugs-autoloads hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-autoloads
/home/albinus/src/elpa/packages/debbugs/debbugs-pkg hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-pkg
/home/albinus/src/elpa/packages/debbugs/debbugs-browse hides /home/albinus/.emacs.d/elpa/debbugs-0.15/debbugs-browse
~/lisp/telepathy hides /home/albinus/.emacs.d/elpa/telepathy-20131209.458/telepathy
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-autoloads hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-autoloads
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-pkg hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-pkg
~/src/tramp/lisp/tramp-smb hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-smb
~/src/tramp/lisp/tramp-uu hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-uu
~/src/tramp/lisp/tramp-adb hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-adb
~/src/tramp/lisp/tramp-compat hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-compat
~/src/tramp/lisp/tramp-archive hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-archive
~/src/tramp/lisp/tramp hides /usr/local/share/emacs/27.0.50/lisp/net/tramp
~/src/tramp/lisp/trampver hides /usr/local/share/emacs/27.0.50/lisp/net/trampver
~/src/tramp/lisp/tramp-ftp hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-ftp
~/src/tramp/lisp/tramp-cmds hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-cmds
~/src/tramp/lisp/tramp-gvfs hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-gvfs
~/src/tramp/lisp/tramp-loaddefs hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-loaddefs
~/lisp/dbus hides /usr/local/share/emacs/27.0.50/lisp/net/dbus
~/src/tramp/lisp/tramp-sh hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-sh
~/src/tramp/lisp/tramp-cache hides /usr/local/share/emacs/27.0.50/lisp/net/tramp-cache

Features:
(shadow warnings emacsbug misearch multi-isearch org-rmail org-mhe
org-irc org-info org-gnus org-docview doc-view image-mode org-bibtex
bibtex org-bbdb org-w3m org-element avl-tree generator org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs shr-color color
url-http url-gw url-cache url-auth eww mm-url url-queue url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
flow-fill url-util shr text-property-search svg dom browse-url gnus-dup
mm-archive vc-hg ediff-vers ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util ediff vc-git diff-mode easy-mmode
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc time-stamp
mailalias sort smiley gnus-cite mail-extr gnus-async gnus-bcklg nnir qp
gnus-ml pop3 utf-7 nndraft nnmh nnml gnutls network-stream nsm
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art
mm-uu mml2015 mm-view mml-smime smime dig mailcap gnus-cache gnus-sum
nnnil smtpmail sendmail gnus-demon nntp gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win
gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr wid-edit elec-pair erc-notify erc-networks
erc-desktop-notifications erc-match notifications dbus xml erc-goodies
erc erc-backend erc-compat thingatpt pp erc-loaddefs cperl-mode time
tramp-sh kubernetes-tramp lxc-tramp docker-tramp tramp-cache
vagrant-tramp dash term disp-table ehelp tramp trampver tramp-compat
tramp-loaddefs ucs-normalize shell pcomplete comint ansi-color ring
parse-time format-spec advice ido jka-compr icomplete paren vc
vc-dispatcher dired dired-loaddefs time-date mule-util rx edmacro kmacro
slime-autoloads info finder-inf package let-alist derived pcase cl-extra
help-mode easymenu url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq
byte-opt gv bytecomp byte-compile cconv epg epg-config subr-x
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 557532 85432)
 (symbols 48 45940 7)
 (miscs 40 141 443)
 (strings 32 127647 10086)
 (string-bytes 1 4323265)
 (vectors 16 72752)
 (vector-slots 8 1839145 209770)
 (floats 8 482 480)
 (intervals 56 5422 919)
 (buffers 992 46))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 09:40:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org, Michael Albinus <michael.albinus <at> gmx.de>,
 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Mon, 13 Aug 2018 12:39:30 +0300
On August 13, 2018 11:40:06 AM GMT+03:00, Michael Albinus <michael.albinus <at> gmx.de> wrote:
> 
> This is about the feature/tramp-thread-safe branch. The bug seems to
> be
> related to the threads implementation in general; that branch is used
> only because it is simpler to demonstrate.
> 
> I have two files, a.test and b.test. Both files have the same contents
> 
> --8<---------------cut here---------------start------------->8---
> Local Variables:
> risky-variable: nil
> End:
> --8<---------------cut here---------------end--------------->8---
> 
> I open both files asynchronously via "C-x & C-x C-f *.test". The
> buffer
> *Local Variables* is displayed, and in the minibuffer I'm asked
> "Please
> type y, n, or !, or C-v to scroll:". Whatever key I type, I get "y is
> undefined".
> 
> I have no idea how to debug this.


See bug#25214.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 09:40:02 GMT) Full text and rfc822 format available.

Merged 25214 32426. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Mon, 13 Aug 2018 12:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 12:18:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bug-gnu-emacs <at> gnu.org, 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Mon, 13 Aug 2018 14:17:12 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Eli,

> See bug#25214.

Thanks, I've merged both bugs. Bug#25214 has the analysis, but I don't
know which direction we want to continue. Using a message pump, as
proposed by Clément?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 12:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Mon, 13 Aug 2018 14:39:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Mon, 13 Aug 2018 17:38:42 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: bug-gnu-emacs <at> gnu.org, 32426 <at> debbugs.gnu.org
> Date: Mon, 13 Aug 2018 14:17:12 +0200
> 
> > See bug#25214.
> 
> Thanks, I've merged both bugs. Bug#25214 has the analysis, but I don't
> know which direction we want to continue. Using a message pump, as
> proposed by Clément?

I don't know, the discussion never reached any concrete conclusions.
(And the more I think about that, the less I understand how a message
pump could help: after all, keyboard input is already a kind of
"message pump", on the OS level.  It seems we'd eventually have the
same problem: how to allow multiple threads to read from the message
pump.)

Some additional discussion was in this thread:

  http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00607.html

Maybe we need to start a new discussion on emacs-devel, once you read
that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Tue, 14 Aug 2018 10:06:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Tue, 14 Aug 2018 12:05:12 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Eli,

> I don't know, the discussion never reached any concrete conclusions.
> (And the more I think about that, the less I understand how a message
> pump could help: after all, keyboard input is already a kind of
> "message pump", on the OS level.  It seems we'd eventually have the
> same problem: how to allow multiple threads to read from the message
> pump.)
>
> Some additional discussion was in this thread:
>
>   http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00607.html
>
> Maybe we need to start a new discussion on emacs-devel, once you read
> that.

Yes, that's needed. I have also no idea how to fix. But I know that the
proposal to disable keyboard reading for all threads but the main one is
not working; see my example in bug#32426.

Perhaps we need this also for other events, D-Bus and file notifications
come to mind.

I fear I'm not the best one to reanimate this discussion. Keyboard
handling in Emacs is terra incognita for me.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Tue, 14 Aug 2018 15:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Tue, 14 Aug 2018 18:16:00 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: 32426 <at> debbugs.gnu.org
> Date: Tue, 14 Aug 2018 12:05:12 +0200
> 
> > Maybe we need to start a new discussion on emacs-devel, once you read
> > that.
> 
> Yes, that's needed.

Started a discussion on emacs-devel.

> But I know that the proposal to disable keyboard reading for all
> threads but the main one is not working; see my example in
> bug#32426.

I'm not surprised.

> Perhaps we need this also for other events, D-Bus and file notifications
> come to mind.

Possibly, but those seem like an easier nut to crack: AFAIU, each time
we need to watch for D-Bus events, we register a file descriptor for
that, and deregister it when we no longer need it, is that right?  If
so, we could easily make these descriptors watched only by the thread
that registered the watch, the infrastructure for that already exists.

By contrast, there's only one keyboard descriptor.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32426; Package emacs. (Tue, 14 Aug 2018 15:50:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32426 <at> debbugs.gnu.org
Subject: Re: bug#32426: 27.0.50; Loosing key bindings in threads
Date: Tue, 14 Aug 2018 17:48:22 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Eli,

>> Perhaps we need this also for other events, D-Bus and file notifications
>> come to mind.
>
> Possibly, but those seem like an easier nut to crack: AFAIU, each time
> we need to watch for D-Bus events, we register a file descriptor for
> that, and deregister it when we no longer need it, is that right?  If
> so, we could easily make these descriptors watched only by the thread
> that registered the watch, the infrastructure for that already exists.

We need a file descriptor per D-Bus bus (system and session). But
applications register for (asynchronous) method calls and signals on the
buses. This could happen in several threads, so we need a mechanism how
to distribute incoming events to those threads.

But I would postpone this discussion until after we have resolved the
keyboard issue.

Best regards, Michael.




This bug report was last modified 5 years and 249 days ago.

Previous Next


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