Subject: bug#64866: closed (Re: bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 26 Jul 2023 15:58:02 +0000

Your bug report

#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64866: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64866
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64866: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
From: Eli Zaretskii <[email-masked]>
To: Yikai Zhao <[email-masked]>
Cc: [email-masked]
Date: Wed, 26 Jul 2023 18:58:24 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Yikai Zhao <[email-masked]>
> Date: Wed, 26 Jul 2023 23:50:43 +0800
> Cc: [email-masked]
> 
> That's OK, I understand your point. Previously I thought this should
> be treated as a bug because in my mind, "emacsclient -e xxxx" is
> similar to "emacs --eval=xxx" (and further, similar to "python -c
> xxxx"), which is a general interface to evaluate code (but maybe in a
> specific environment (the server)). In that case, arbitrarily sleeping
> some extra seconds in some valid evaluation scenarios seems
> unexpected. Now I can see why that's not the case as the primary
> function of emacsclient is to "tell a running Emacs to visit a file".
> 
> 
> For any others who may be interested, my use case can be workaround by
> using a slightly more complex command:
> 
>     RES="$(emacsclient -e "(condition-case nil (progn (windmove-right)
> t) (error nil))")"
>     if [ "$RES" != "t" ]; then
>         return 1
>     fi

Thanks, I'm therefore closing this bug.

Subject: 30.0.50; Emacsclient block for 2 seconds when error is raised from command
From: Yikai Zhao <[email-masked]>
To: [email-masked]
Date: Wed, 26 Jul 2023 10:10:08 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

After updating to recent master version of emacs, emacsclient would
block for an extra 2 seconds when some error is raised from command.

Minimal reproducable command:

  emacsclient -s <...> -e '(error "x")'

Expected behavior: this command should return immediately
Current behavior: this command take 2 second

Why it affects me:

I bind some keyboard shortcut globally to a script to move either from
emacs window or i3wm window. It does something like this:

   emacsclient -e '(windmove-right)' || i3-msg focus right

It rely on the behavior that, if I'm currently in the rightmost emacs
buffer, '(windmove-right)' would return an error and fallback to use
i3-msg to move to another frame. With this bug I mentioned, it would
introduce 2-second delay on this action.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-23 built on lilac-0
Repository revision: 5d2d28458d0eb378a7e94363ef716e8648ef129a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-native-compilation=aot
 --with-sound=no --with-xwidgets --with-tree-sitter --without-gpm
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -g
 -ffile-prefix-map=/build/emacs-native-comp-git/src=/usr/src/debug/emacs-native-comp-git
 -flto=auto' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
 -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB

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

Major mode: VTerm

Minor modes in effect:
  sudo-edit-indicator-mode: t
  windmove-mode: t
  projectile-mode: t
  recentf-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  pixel-scroll-precision-mode: t
  server-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  save-place-mode: t
  vertico-mode: t
  which-key-mode: t
  global-evil-visualstar-mode: t
  evil-visualstar-mode: t
  evil-snipe-mode: t
  evil-snipe-local-mode: t
  evil-owl-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  evil-commentary-mode: t
  evil-mode: t
  evil-local-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/blahgeek/.emacs.d/lib/cmake-mode/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/home/blahgeek/.emacs.d/lib/protobuf-mode/protobuf-mode hides /usr/share/emacs/site-lisp/protobuf-mode
/home/blahgeek/.emacs.d/lib/transient/lisp/transient hides /usr/share/emacs/30.0.50/lisp/transient
/home/blahgeek/.emacs.d/lib/use-package/use-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package
/home/blahgeek/.emacs.d/lib/use-package/use-package-lint hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/blahgeek/.emacs.d/lib/use-package/use-package-jump hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/blahgeek/.emacs.d/lib/use-package/use-package-ensure hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/blahgeek/.emacs.d/lib/use-package/use-package-ensure-system-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure-system-package
/home/blahgeek/.emacs.d/lib/use-package/use-package-diminish hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/blahgeek/.emacs.d/lib/use-package/use-package-delight hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/blahgeek/.emacs.d/lib/use-package/use-package-core hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/blahgeek/.emacs.d/lib/use-package/use-package-bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/blahgeek/.emacs.d/lib/use-package/bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/bind-key

Features:
(shadow sort mail-extr emacsbug evil-collection-woman woman
evil-collection-man man rfc2104 sudo-edit conf-mode cl-print pulse
consult-xref jka-compr evil-collection-shortdoc shortdoc dired-aux
dired-x help-fns tramp-cmds windmove tramp-cache time-stamp
lsp-diagnostics lsp-modeline evil-collection-view view lsp-zig lsp-tilt
lsp-steep lsp-svelte lsp-sqls lsp-ruby-syntax-tree lsp-ruby-lsp lsp-yaml
lsp-xml lsp-vimscript lsp-vhdl lsp-volar lsp-vetur lsp-html lsp-verilog
lsp-vala lsp-v lsp-typeprof lsp-ttcn3 lsp-toml lsp-terraform lsp-tex
lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-ruff-lsp lsp-remark
lsp-racket lsp-r lsp-purescript lsp-pylsp lsp-pyls lsp-pwsh lsp-php
lsp-pls lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-magik
lsp-nix lsp-nim lsp-nginx lsp-mint lsp-marksman lsp-markdown lsp-lua
lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy
lsp-hack lsp-graphql lsp-glsl lsp-gleam lsp-go lsp-completion
lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-emmet
lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp
gnutls lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd
dom lsp-beancount lsp-bash lsp-astro lsp-ansible lsp-angular lsp-ada
lsp-actionscript lsp-haskell haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support evil-collection-flymake
flymake-proc flymake etags fileloop generator dabbrev haskell-customize
lsp-pyright lsp-mode lsp-protocol evil-collection-xref xref spinner
network-stream nsm evil-collection-markdown-mode markdown-mode lv inline
ht ewoc vertico-directory evil-vimish-fold vimish-fold f f-shortdoc
git-gutter-fringe fringe-helper git-gutter flycheck-posframe posframe
flycheck-google-cpplint evil-collection-flycheck flycheck ligature
whitespace hl-line display-line-numbers elec-pair hl-todo dtrt-indent
tempel copilot evil-collection-org org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities evil-collection-outline noutline
outline ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs evil-collection-calendar cal-menu
calendar cal-loaddefs org-version org-compat org-macs editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch s
jsonrpc xonsh-mode evil-collection-sh-script sh-script smie executable
evil-collection-python python treesit orderless projectile project
evil-collection-grep grep ibuf-ext evil-collection-ibuffer ibuffer
ibuffer-loaddefs recentf tree-widget wid-edit evil-collection-consult
consult autoinsert vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
evil-collection-log-view log-view evil-collection-vc-git vc-git vc
vc-dispatcher bug-reference company-keywords company-dabbrev-code
company-dabbrev company-capf company-files company magit-bookmark
evil-collection-magit magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit evil-collection-package-menu package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-handlers magit-repos magit-apply magit-wip
magit-log which-func evil-collection-imenu imenu magit-diff smerge-mode
diff evil-collection-diff-mode diff-mode git-commit
evil-collection-log-edit log-edit message sendmail mailcap yank-media
puny rfc822 mml mml-sec evil-collection-epa epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor magit-mode
transient magit-git magit-base evil-collection-magit-section
magit-section cursor-sensor crm dash time pixel-scroll cua-base
auth-source-pass url-parse url-vars server fcitx dbus xml winner
evil-collection-vterm vterm evil-collection-bookmark bookmark pp
face-remap evil-collection-compile compile text-property-search
evil-collection-term term disp-table ehelp find-func vterm-module
term/xterm xterm cc-styles cc-align cc-engine cc-vars cc-defs
google-c-style autorevert filenotify saveplace tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat xdg shell
pcomplete evil-collection-comint comint ansi-osc parse-time iso8601
time-date auth-source eieio eieio-core password-cache json map
ansi-color cus-load evil-collection-vertico vertico compat
solarized-light-theme solarized-theme solarized solarized-faces color
evil-collection-which-key which-key fringe-scale switch-buffer-functions
evil-visualstar evil-snipe evil-owl format-spec evil-surround
evil-commentary evil-commentary-integration
evil-collection-tabulated-list evil-collection-tab-bar
evil-collection-simple evil-collection-replace
evil-collection-process-menu evil-collection-info evil-collection-indent
evil-collection-image image-mode evil-collection-dired dired
dired-loaddefs exif evil-collection-help evil-collection-elisp-mode
evil-collection-eldoc evil-collection-buff-menu evil-collection annalist
evil evil-integration evil-maps evil-commands reveal evil-jumps
evil-command-window evil-search evil-ex evil-types evil-macros
evil-repeat evil-states evil-core advice evil-common thingatpt rect
evil-digraphs evil-vars ring edmacro kmacro byte-opt delight comp
comp-cstr warnings icons cl-macs gv use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core yaml-mode-autoloads xonsh-mode-autoloads
with-editor-autoloads which-key-autoloads wgrep-autoloads
vterm-autoloads vimrc-mode-autoloads vimish-fold-autoloads
vertico-autoloads use-package-autoloads treepy-autoloads
transient-autoloads tempel-autoloads switch-buffer-functions-autoloads
suggest-autoloads sudo-edit-autoloads spinner-autoloads
solarized-theme-autoloads s-autoloads rust-mode-autoloads rg-autoloads
rainbow-mode-autoloads pydoc-autoloads protobuf-mode-autoloads
projectile-autoloads pr-review-autoloads posframe-autoloads
popup-autoloads pkg-info-autoloads package-lint-autoloads
org-tree-slide-autoloads orderless-autoloads markdown-mode-autoloads
magit-autoloads lv-autoloads lua-mode-autoloads lsp-pyright-autoloads
lsp-mode-autoloads lsp-haskell-autoloads loop-autoloads llama-autoloads
ligature-autoloads kotlin-mode-autoloads just-mode-autoloads
jsonnet-mode-autoloads jinja2-mode-autoloads ht-autoloads
hl-todo-autoloads haskell-mode-autoloads groovy-mode-autoloads
gptel-autoloads goto-chg-autoloads google-c-style-autoloads
go-mode-autoloads gn-mode-autoloads git-link-autoloads
git-gutter-fringe-autoloads git-gutter-autoloads ghub-autoloads
fringe-helper-autoloads flycheck-posframe-autoloads
flycheck-package-autoloads flycheck-autoloads fish-mode-autoloads
fcitx-autoloads f-autoloads exec-path-from-shell-autoloads
evil-visualstar-autoloads evil-vimish-fold-autoloads
evil-surround-autoloads evil-snipe-autoloads evil-owl-autoloads
evil-commentary-autoloads evil-collection-autoloads evil-autoloads
epl-autoloads epkg-autoloads embark-autoloads emacsql-autoloads
emacs-fringe-scale-autoloads editorconfig-autoloads dumb-jump-autoloads
dtrt-indent-autoloads dockerfile-mode-autoloads
devdocs-browser-autoloads delight-autoloads dash-autoloads
cuda-mode-autoloads corfu-autoloads copilot-autoloads
consult-flycheck-autoloads consult-autoloads compat-autoloads
company-emoji-autoloads company-autoloads cmake-mode-autoloads
closql-autoloads bpftrace-mode-autoloads borg-autoloads bazel-autoloads
rx annalist-autoloads cl-extra help-mode add-node-modules-path-autoloads
cl-seq borg loaddefs-gen generate-lisp-file lisp-mnt radix-tree subr-x
pcase info cl-loaddefs cl-lib bytecomp byte-compile rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode 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 lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x
multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 914042 1065405) (symbols 48 49562 0)
 (strings 32 230924 32235) (string-bytes 1 8178630)
 (vectors 16 107518) (vector-slots 8 2649746 403281)
 (floats 8 648 8033) (intervals 56 29932 3912) (buffers 984 39))