unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: daimrod@omecha.info, 29170@debbugs.gnu.org
Subject: bug#29170: 26.0.90; Emacs freezes when capturing an org-template
Date: Fri, 02 Oct 2020 16:30:45 +0200	[thread overview]
Message-ID: <87blhkwvhm.fsf@gnus.org> (raw)
In-Reply-To: <83sgaxf6eb.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 02 Oct 2020 10:12:28 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> Can you debug the cause which causes the freeze?  What is the code
> that freezes?

I haven't debugged it, but Manuel said previously in this thread that
the following patch sort of fixes the problem (included below), but it
then leads to other issues.

But the problem is in that area, I take it.

-----

Here is a patch against HEAD to avoid the hang in infinite loop. The
'x-selection-timeout' pause will still be there even with this patch.

My understandings:

On OpenBSD, most of the time, the function
"xselect.c/x_get_foreign_selection" won't get a SelectNotify with
(SECONDARY, TEXT) as arguments (that I did not understand and it might
never happen on other oses).

But then, while waiting at most 'x-selection-timeout' into
"process.c/wait_reading_process_output" the 'now' variable won't have a
chance of being invalidated or updated and that is what cause the
infinite loop.

Someone more knowledgeable of "process.c/wait_reading_process_output"
might have a better solution to this problem.

diff --git a/src/process.c b/src/process.c
index fc46e74332..25bd28a82b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5115,8 +5115,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
       /* Exit if already run out.  */
       if (wait == TIMEOUT)
 	{
-	  if (!timespec_valid_p (now))
-	    now = current_timespec ();
+	  now = current_timespec ();
 	  if (timespec_cmp (end_time, now) <= 0)
 	    break;
 	  timeout = timespec_sub (end_time, now);


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-10-02 14:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <877dtojnf0.fsf@elite.giraud>
2017-11-06 14:20 ` bug#29170: 26.0.90; Emacs freezes when capturing an org-template Grégoire Jadi
2017-11-08 18:00   ` bug#29170: Infinite loop noticed on Emacs in OpenBSD Piotr Isajew
2017-11-09 15:06   ` Manuel Giraud
2017-11-17 14:36     ` Grégoire Jadi
2017-11-22 14:44       ` Manuel Giraud
2017-11-22 14:50         ` Grégoire Jadi
2017-11-22 15:00           ` Manuel Giraud
2020-08-24 11:43   ` Stefan Kangas
2020-08-24 11:45   ` Stefan Kangas
2020-10-02  5:16   ` bug#29170: 26.0.90; Emacs freezes when capturing an org-template Lars Ingebrigtsen
2020-10-02  7:12     ` Eli Zaretskii
2020-10-02 14:30       ` Lars Ingebrigtsen [this message]
2020-10-02 15:08         ` Eli Zaretskii
2020-10-02 17:55           ` daimrod
2020-10-03 17:51             ` Lars Ingebrigtsen
2020-10-08 21:43               ` daimrod
2020-10-10 19:57                 ` Lars Ingebrigtsen
2021-08-08 14:33                   ` Grégoire Jadi
2021-08-08 14:49                     ` Eli Zaretskii
2021-08-08 14:53                       ` Grégoire Jadi
2021-08-09 12:31                     ` Lars Ingebrigtsen
2021-08-13  7:36                       ` Grégoire Jadi
2021-08-13 11:50                         ` Lars Ingebrigtsen
2021-08-13 11:52                           ` Lars Ingebrigtsen
2021-05-25 10:55   ` bug#29170: bug29170 graeme vetterlein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blhkwvhm.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=29170@debbugs.gnu.org \
    --cc=daimrod@omecha.info \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).