GNU bug report logs - #65678
30.0.50; EWW rendered errs when the EWW buffer is closed before the page gets loaded

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Fri, 1 Sep 2023 13:45:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65678 in the body.
You can then email your comments to 65678 AT debbugs.gnu.org in the normal way.

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#65678; Package emacs. (Fri, 01 Sep 2023 13:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ihor Radchenko <yantar92 <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 01 Sep 2023 13:45:02 GMT) Full text and rfc822 format available.

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

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; EWW rendered errs when the EWW buffer is closed before the
 page gets loaded
Date: Fri, 01 Sep 2023 13:44:26 +0000
When I quickly open and close a EWW page, I get the following error
after a while:

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  (eww-render (:peer ...) "https://sfba.social/@kickingvegas/1109829258114145..." nil #<killed buffer> nil)
  (url-http-activate-callback)
  (url-http-chunked-encoding-after-change-function 12257 12929 672)
  (url-http-generic-filter #<process sfba.social> "\312V\5.-i\205KKZ\341R\236o;%.-\326/p)\357\317\0G\342Rx\33B\215(q\247b\277\200\245$G\337\360\306\335\352\364\5,-...")

I'd expect no error to be thrown and the rendered silently stopping.

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-08-29 built on localhost
Repository revision: 5e254a0f46e2410763d1b58135442ed0d50b0fed
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65678; Package emacs. (Sat, 02 Sep 2023 08:01:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 65678 <at> debbugs.gnu.org
Subject: Re: bug#65678: 30.0.50;
 EWW rendered errs when the EWW buffer is closed before the page gets
 loaded
Date: Sat, 02 Sep 2023 11:00:10 +0300
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Fri, 01 Sep 2023 13:44:26 +0000
> 
> When I quickly open and close a EWW page, I get the following error
> after a while:
> 
> Debugger entered--Lisp error: (error "Selecting deleted buffer")
>   (eww-render (:peer ...) "https://sfba.social/@kickingvegas/1109829258114145..." nil #<killed buffer> nil)
>   (url-http-activate-callback)
>   (url-http-chunked-encoding-after-change-function 12257 12929 672)
>   (url-http-generic-filter #<process sfba.social> "\312V\5.-i\205KKZ\341R\236o;%.-\326/p)\357\317\0G\342Rx\33B\215(q\247b\277\200\245$G\337\360\306\335\352\364\5,-...")
> 
> I'd expect no error to be thrown and the rendered silently stopping.

I couldn't easily simulate that here (you didn't say what you do to
"close a EWW page"), so would you please see if the change below gives
good results?

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 089e481..b87e785 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -620,47 +620,48 @@ eww-render
     (let ((redirect (plist-get status :redirect)))
       (when redirect
         (setq url redirect)))
-    (with-current-buffer buffer
-      ;; Save the https peer status.
-      (plist-put eww-data :peer (plist-get status :peer))
-      ;; Make buffer listings more informative.
-      (setq list-buffers-directory url)
-      ;; Let the URL library have a handle to the current URL for
-      ;; referer purposes.
-      (setq url-current-lastloc (url-generic-parse-url url)))
-    (unwind-protect
-	(progn
-	  (cond
-           ((and eww-use-external-browser-for-content-type
-                 (string-match-p eww-use-external-browser-for-content-type
-                                 (car content-type)))
-            (erase-buffer)
-            (insert "<title>Unsupported content type</title>")
-            (insert (format "<h1>Content-type %s is unsupported</h1>"
-                            (car content-type)))
-            (insert (format "<a href=%S>Direct link to the document</a>"
-                            url))
-            (goto-char (point-min))
-	    (eww-display-html charset url nil point buffer encode))
-	   ((eww-html-p (car content-type))
-	    (eww-display-html charset url nil point buffer encode))
-	   ((equal (car content-type) "application/pdf")
-	    (eww-display-pdf))
-	   ((string-match-p "\\`image/" (car content-type))
-	    (eww-display-image buffer))
-	   (t
-	    (eww-display-raw buffer (or encode charset 'utf-8))))
-	  (with-current-buffer buffer
-	    (plist-put eww-data :url url)
-	    (eww--after-page-change)
-	    (setq eww-history-position 0)
-	    (and last-coding-system-used
-		 (set-buffer-file-coding-system last-coding-system-used))
-	    (run-hooks 'eww-after-render-hook)
-            ;; Enable undo again so that undo works in text input
-            ;; boxes.
-            (setq buffer-undo-list nil)))
-      (kill-buffer data-buffer))))
+    (when (buffer-live-p buffer)
+      (with-current-buffer buffer
+        ;; Save the https peer status.
+        (plist-put eww-data :peer (plist-get status :peer))
+        ;; Make buffer listings more informative.
+        (setq list-buffers-directory url)
+        ;; Let the URL library have a handle to the current URL for
+        ;; referer purposes.
+        (setq url-current-lastloc (url-generic-parse-url url)))
+      (unwind-protect
+	  (progn
+	    (cond
+             ((and eww-use-external-browser-for-content-type
+                   (string-match-p eww-use-external-browser-for-content-type
+                                   (car content-type)))
+              (erase-buffer)
+              (insert "<title>Unsupported content type</title>")
+              (insert (format "<h1>Content-type %s is unsupported</h1>"
+                              (car content-type)))
+              (insert (format "<a href=%S>Direct link to the document</a>"
+                              url))
+              (goto-char (point-min))
+	      (eww-display-html charset url nil point buffer encode))
+	     ((eww-html-p (car content-type))
+	      (eww-display-html charset url nil point buffer encode))
+	     ((equal (car content-type) "application/pdf")
+	      (eww-display-pdf))
+	     ((string-match-p "\\`image/" (car content-type))
+	      (eww-display-image buffer))
+	     (t
+	      (eww-display-raw buffer (or encode charset 'utf-8))))
+	    (with-current-buffer buffer
+	      (plist-put eww-data :url url)
+	      (eww--after-page-change)
+	      (setq eww-history-position 0)
+	      (and last-coding-system-used
+		   (set-buffer-file-coding-system last-coding-system-used))
+	      (run-hooks 'eww-after-render-hook)
+              ;; Enable undo again so that undo works in text input
+              ;; boxes.
+              (setq buffer-undo-list nil)))
+        (kill-buffer data-buffer)))))
 
 (defun eww-parse-headers ()
   (let ((headers nil))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65678; Package emacs. (Sat, 02 Sep 2023 11:39:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: yantar92 <at> posteo.net
Cc: 65678 <at> debbugs.gnu.org
Subject: Re: bug#65678: 30.0.50;
 EWW rendered errs when the EWW buffer is closed before the page gets
 loaded
Date: Sat, 02 Sep 2023 14:38:16 +0300
> Cc: 65678 <at> debbugs.gnu.org
> Date: Sat, 02 Sep 2023 11:00:10 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> I couldn't easily simulate that here (you didn't say what you do to
> "close a EWW page"), so would you please see if the change below gives
> good results?

Sorry, that patch included a thinko.  Please try the below one
instead:

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 089e481..4ddda21 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -620,46 +620,49 @@ eww-render
     (let ((redirect (plist-get status :redirect)))
       (when redirect
         (setq url redirect)))
-    (with-current-buffer buffer
-      ;; Save the https peer status.
-      (plist-put eww-data :peer (plist-get status :peer))
-      ;; Make buffer listings more informative.
-      (setq list-buffers-directory url)
-      ;; Let the URL library have a handle to the current URL for
-      ;; referer purposes.
-      (setq url-current-lastloc (url-generic-parse-url url)))
-    (unwind-protect
-	(progn
-	  (cond
-           ((and eww-use-external-browser-for-content-type
-                 (string-match-p eww-use-external-browser-for-content-type
-                                 (car content-type)))
-            (erase-buffer)
-            (insert "<title>Unsupported content type</title>")
-            (insert (format "<h1>Content-type %s is unsupported</h1>"
-                            (car content-type)))
-            (insert (format "<a href=%S>Direct link to the document</a>"
-                            url))
-            (goto-char (point-min))
-	    (eww-display-html charset url nil point buffer encode))
-	   ((eww-html-p (car content-type))
-	    (eww-display-html charset url nil point buffer encode))
-	   ((equal (car content-type) "application/pdf")
-	    (eww-display-pdf))
-	   ((string-match-p "\\`image/" (car content-type))
-	    (eww-display-image buffer))
-	   (t
-	    (eww-display-raw buffer (or encode charset 'utf-8))))
-	  (with-current-buffer buffer
-	    (plist-put eww-data :url url)
-	    (eww--after-page-change)
-	    (setq eww-history-position 0)
-	    (and last-coding-system-used
-		 (set-buffer-file-coding-system last-coding-system-used))
-	    (run-hooks 'eww-after-render-hook)
-            ;; Enable undo again so that undo works in text input
-            ;; boxes.
-            (setq buffer-undo-list nil)))
+    (when (buffer-live-p buffer)
+      (with-current-buffer buffer
+        ;; Save the https peer status.
+        (plist-put eww-data :peer (plist-get status :peer))
+        ;; Make buffer listings more informative.
+        (setq list-buffers-directory url)
+        ;; Let the URL library have a handle to the current URL for
+        ;; referer purposes.
+        (setq url-current-lastloc (url-generic-parse-url url)))
+      (unwind-protect
+	  (progn
+	    (cond
+             ((and eww-use-external-browser-for-content-type
+                   (string-match-p eww-use-external-browser-for-content-type
+                                   (car content-type)))
+              (erase-buffer)
+              (insert "<title>Unsupported content type</title>")
+              (insert (format "<h1>Content-type %s is unsupported</h1>"
+                              (car content-type)))
+              (insert (format "<a href=%S>Direct link to the document</a>"
+                              url))
+              (goto-char (point-min))
+	      (eww-display-html charset url nil point buffer encode))
+	     ((eww-html-p (car content-type))
+	      (eww-display-html charset url nil point buffer encode))
+	     ((equal (car content-type) "application/pdf")
+	      (eww-display-pdf))
+	     ((string-match-p "\\`image/" (car content-type))
+	      (eww-display-image buffer))
+	     (t
+	      (eww-display-raw buffer (or encode charset 'utf-8))))
+	    (with-current-buffer buffer
+	      (plist-put eww-data :url url)
+	      (eww--after-page-change)
+	      (setq eww-history-position 0)
+	      (and last-coding-system-used
+		   (set-buffer-file-coding-system last-coding-system-used))
+	      (run-hooks 'eww-after-render-hook)
+              ;; Enable undo again so that undo works in text input
+              ;; boxes.
+              (setq buffer-undo-list nil)))
+        (kill-buffer data-buffer)))
+    (unless (buffer-live-p buffer)
       (kill-buffer data-buffer))))
 
 (defun eww-parse-headers ()




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65678; Package emacs. (Fri, 08 Sep 2023 08:48:01 GMT) Full text and rfc822 format available.

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

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65678 <at> debbugs.gnu.org
Subject: Re: bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is
 closed before the page gets loaded
Date: Fri, 08 Sep 2023 08:48:06 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 65678 <at> debbugs.gnu.org
>> Date: Sat, 02 Sep 2023 11:00:10 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> 
>> I couldn't easily simulate that here (you didn't say what you do to
>> "close a EWW page"), so would you please see if the change below gives
>> good results?
>
> Sorry, that patch included a thinko.  Please try the below one
> instead:

After applying this patch, I am no longer seeing the errors.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 08 Sep 2023 12:14:01 GMT) Full text and rfc822 format available.

Notification sent to Ihor Radchenko <yantar92 <at> posteo.net>:
bug acknowledged by developer. (Fri, 08 Sep 2023 12:14:02 GMT) Full text and rfc822 format available.

Message #19 received at 65678-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 65678-done <at> debbugs.gnu.org
Subject: Re: bug#65678: 30.0.50; EWW rendered errs when the EWW buffer is
 closed before the page gets loaded
Date: Fri, 08 Sep 2023 15:12:23 +0300
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Cc: 65678 <at> debbugs.gnu.org
> Date: Fri, 08 Sep 2023 08:48:06 +0000
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Cc: 65678 <at> debbugs.gnu.org
> >> Date: Sat, 02 Sep 2023 11:00:10 +0300
> >> From: Eli Zaretskii <eliz <at> gnu.org>
> >> 
> >> I couldn't easily simulate that here (you didn't say what you do to
> >> "close a EWW page"), so would you please see if the change below gives
> >> good results?
> >
> > Sorry, that patch included a thinko.  Please try the below one
> > instead:
> 
> After applying this patch, I am no longer seeing the errors.

Thanks, installed on master, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 07 Oct 2023 11:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 216 days ago.

Previous Next


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