all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Strange Emacs "hiccup" bug
@ 2014-05-10 20:13 Jorgen Schaefer
  2014-05-23 14:22 ` Jorgen Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jorgen Schaefer @ 2014-05-10 20:13 UTC (permalink / raw
  To: emacs-devel

Hello!

I am trying to debug a problem I have encountered a few times now, but
I'm at a loss as to what to do next to figure out what is happening.
Maybe someone here has an idea.

I have witnessed this bug, or at least one that looks *very much* like
this, a number of times over the last months. I have re-built Emacs a
few times in between. The current build is from trunk on 2014-05-01.

At some point, apparently after some time of continuous use, Emacs
starts to pause intermittently. It stops responding to keys or
redisplaying for half a second, then it goes on. It does not matter
which mode or buffer is in use.

In this particular case, after a few attempts to figure out what's
going on with no effect, I simply killed all buffers. The behavior
continued, even in *Messages*.

A look at the process list showed a bunch of zombie processes around:

15361 ?        Ss     0:33 SCREEN
15362 pts/1    Ss     0:00  \_ /bin/bash
18175 pts/1    R+    37:06  |   \_ emacs
18206 ?        Zs     0:00  |       \_ [openssl] <defunct>
23385 ?        Zs     0:04  |       \_ [openssl] <defunct>
24238 ?        Zs     0:00  |       \_ [aspell] <defunct>
24999 ?        Zs     0:00  |       \_ [aspell] <defunct>
28117 ?        Zs     0:00  |       \_ [bash] <defunct>
18706 ?        Zs     0:00  |       \_ [python] <defunct>
20096 ?        Zs     0:00  |       \_ [python] <defunct>

A strace -fttT showed a very fast loop doing this:

21:24:00.948071 pselect6(12, [3 4 9 11], [], NULL, {0, 1376013},
                {NULL, 8}) = 2 (in [9 11], left {0, 1373467}) <0.000011>
21:24:00.948529 read(9, "", 4096)       = 0 <0.000009>
21:24:00.948564 read(11, "", 4096)      = 0 <0.000008>

It turned out 9 and 11 were two pipes to openssl. Emacs still had
three processes active: The emacsclient server and two openssl
connections. Even though both openssl connections had died.

Deleting the processes in Emacs improved responsiveness somewhat, but
did not completely remove the "hiccups". The strace behavior returned
to normal, though.

A M-x toggle-debug-on-quit and some lucky C-g's got me the following:

Error during redisplay: (#[128 "\300\301^B\"\210\300\302^B\"\207"
[apply redisplay--update-region-highlights ignore nil] 4 nil nil] nil)
signaled (quit)

But I'm not sure if that is really related, or if it just happened to
be what Emacs was evaluating at that time.

Now I'm stuck. Any ideas what I can do to debug this further?

Regards,
Jorgen



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange Emacs "hiccup" bug
  2014-05-10 20:13 Strange Emacs "hiccup" bug Jorgen Schaefer
@ 2014-05-23 14:22 ` Jorgen Schaefer
  2014-05-23 15:37   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Jorgen Schaefer @ 2014-05-23 14:22 UTC (permalink / raw
  To: emacs-devel

Some update on this bug, as I was able to reproduce it *temporarily*.

On Sat, 10 May 2014 22:13:51 +0200
Jorgen Schaefer <forcer@forcix.cx> wrote:

> At some point, apparently after some time of continuous use, Emacs
> starts to pause intermittently. It stops responding to keys or
> redisplaying for half a second, then it goes on. It does not matter
> which mode or buffer is in use.

This weird seemingly unrelated behavior is probably because I use a lot
of processes, both for flyspell and Python interaction and RPC calls.
The problem can occur when one of the processes dies.

I have been able to return Emacs to usable behavior multiple times
after such incidents happen by killing some idle processes, and they all
exhibit the same behavior:

A process dies (for example, when its buffer gets killed), but Emacs
does not forget it. It will show up in the process list, without an
associated buffer, and Emacs will be stuck in a tight loop trying to
read from these processes without success:

> 21:24:00.948071 pselect6(12, [3 4 9 11], [], NULL, {0, 1376013},
>                 {NULL, 8}) = 2 (in [9 11], left {0, 1373467})
>                 <0.000011>
> 21:24:00.948529 read(9, "", 4096)       = 0 <0.000009>
> 21:24:00.948564 read(11, "", 4096)      = 0 <0.000008>

I have been able to reproduce this behavior *sometimes* using the
following snippet:

(with-temp-buffer
  (let ((process-connection-type nil))
    (set-process-query-on-exit-flag
     (start-process "cat" (current-buffer) "cat")
     nil)))

I.e. create a buffer, associate a process with it, remove the query on
exit flag, and kill the buffer. The process stays around in the process
list and the process will remain in "ps" as a zombie.

The `process-connection-type' nil is the relevant part. With t, it
works correctly.

Now the weird part: This bug does not happen in a new copy of Emacs.
But when I have Emacs running for a while, suddenly the code snippet
above triggers the bug reliably.

After a while, Emacs catches up with itself, cleans up the zombie
processes, and the code above does not trigger the bug anymore. Until,
a random while later, it suddenly does again.

I have seen this happen in 24.3.50, 24.3.91 (pretest 2), and current
trunk.

Any ideas what might be happening here?

Regards,
Jorgen



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange Emacs "hiccup" bug
  2014-05-23 14:22 ` Jorgen Schaefer
@ 2014-05-23 15:37   ` Stefan Monnier
  2014-05-23 16:12     ` Jorgen Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2014-05-23 15:37 UTC (permalink / raw
  To: Jorgen Schaefer; +Cc: emacs-devel

> I have seen this happen in 24.3.50, 24.3.91 (pretest 2), and current
> trunk.

Can you make it a bug report (i.e. send it via M-x report-emacs-bug) so
we get a tracking number?

> Any ideas what might be happening here?

Sadly, no, I'm not familiar with this part of the process handling code.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange Emacs "hiccup" bug
  2014-05-23 15:37   ` Stefan Monnier
@ 2014-05-23 16:12     ` Jorgen Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Jorgen Schaefer @ 2014-05-23 16:12 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

On Fri, 23 May 2014 11:37:15 -0400
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > I have seen this happen in 24.3.50, 24.3.91 (pretest 2), and current
> > trunk.
> 
> Can you make it a bug report (i.e. send it via M-x report-emacs-bug)
> so we get a tracking number?

Done as bug#17561. Forgot before as I did not have anything to report
until earlier today - could have been my own code or anything. :-)

Regards,
Jorgen



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-23 16:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-10 20:13 Strange Emacs "hiccup" bug Jorgen Schaefer
2014-05-23 14:22 ` Jorgen Schaefer
2014-05-23 15:37   ` Stefan Monnier
2014-05-23 16:12     ` Jorgen Schaefer

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.