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.
This commit is contained in:
João Távora 2025-12-08 21:39:34 +00:00
parent 74348a722a
commit 6caf598ac4

View file

@ -4,7 +4,7 @@
;; Author: João Távora <joaotavora@gmail.com>
;; 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))