From 6caf598ac49b3ed592f22e31307fe71e71490f2b Mon Sep 17 00:00:00 2001 From: João Távora Date: Mon, 8 Dec 2025 21:39:34 +0000 Subject: 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. --- lisp/jsonrpc.el | 4 ++-- 1 file 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 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions -;; Version: 1.0.26 +;; Version: 1.0.27 ;; Package-Requires: ((emacs "25.2")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -1109,7 +1109,7 @@ PREFIX to CONN's events buffer." (unless (eql max 0) (cl-loop initially (goto-char beg) do (forward-line) - when (bolp) + while (bolp) for line = (buffer-substring (line-beginning-position 0) (line-end-position 0)) -- cgit v1.2.1