aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2025-12-08 21:39:34 +0000
committerJoão Távora2025-12-08 21:41:31 +0000
commit6caf598ac49b3ed592f22e31307fe71e71490f2b (patch)
treec1419d430689212e85b98ee4ac735167a77b0f44
parent74348a722a47b9592f30e276be2c1381f36eb824 (diff)
downloademacs-6caf598ac49b3ed592f22e31307fe71e71490f2b.tar.gz
emacs-6caf598ac49b3ed592f22e31307fe71e71490f2b.zip
Jsonrpc: defend against very large stderr lines
In https://github.com/joaotavora/rassumfrassum/issues/1 we found a language server that emits very large single-line messages (5MB): that eventually end up in Eglot's stderr. With the output arriving in chunks into the stderr buffer, this creates a significant slowdown of '[stderr] nil' lines, which eventually clogs up the stdout JSONRPC communication. This fix exits the `jsonrpc--forwarding-buffer` function early if the forward-line call didn't actually move to a new line. * lisp/jsonrpc.el (jsonrpc--forwarding-buffer): Fix. (Version): Bump to 1.0.27.
-rw-r--r--lisp/jsonrpc.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 808c1fdd147..ca2647971fd 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -4,7 +4,7 @@
4 4
5;; Author: João Távora <joaotavora@gmail.com> 5;; Author: João Távora <joaotavora@gmail.com>
6;; Keywords: processes, languages, extensions 6;; Keywords: processes, languages, extensions
7;; Version: 1.0.26 7;; Version: 1.0.27
8;; Package-Requires: ((emacs "25.2")) 8;; Package-Requires: ((emacs "25.2"))
9 9
10;; This is a GNU ELPA :core package. Avoid functionality that is not 10;; This is a GNU ELPA :core package. Avoid functionality that is not
@@ -1109,7 +1109,7 @@ PREFIX to CONN's events buffer."
1109 (unless (eql max 0) 1109 (unless (eql max 0)
1110 (cl-loop initially (goto-char beg) 1110 (cl-loop initially (goto-char beg)
1111 do (forward-line) 1111 do (forward-line)
1112 when (bolp) 1112 while (bolp)
1113 for line = (buffer-substring 1113 for line = (buffer-substring
1114 (line-beginning-position 0) 1114 (line-beginning-position 0)
1115 (line-end-position 0)) 1115 (line-end-position 0))