Re: JDE runaway background write()? (bug?)

"Denis Bueno" <[email protected]> Wed, 14 Mar 2007 16:31:22 -0400
Newsgroups gmane.emacs.jdee
Message-ID <[email protected]>
From the strace output, fd 4 is connected to /tmp/.X11-unix/X0 which
according to a thread on some other mailing list is X's display 0.

This suggests that perhaps the problem is too-eager fontifying? Is
fontification done in some sort of loop somewhere, that might cause
this problem? I'm happy to help debug the problem if I can get some
pointers.

Thanks.

-Denis

On 3/14/07, Denis Bueno <[email protected]> wrote:
> This is a bit of a long post about a bizarre bug I am experiencing in
> my freshly-installed JDE.
>
> I just installed JDE 2.3.5.1 on GNU Emacs 22.0.95.1
> (x86_64-unknown-linux-gnu, GTK+ Version 2.4.13) of 2007-03-13. I
> downloaded & installed CEDET version 1.0pre3 and elib 1.0.
>
> I added the following to my .emacs:
>
>     ;;; jdee
>     (let ((jde-file (expand-file-name "~/.emacs.d/site-lisp/jde/lisp/jde"))
>           (cedet-file (expand-file-name
> "~/.emacs.d/site-lisp/cedet/common/cedet.el")))
>       (when (and jde-file cedet-file)
>         (log-feature 'jdee)
>         ;; load CEDET
>         (load-file cedet-file)
>         ;; autoload jde-mode for .java files.
>         (autoload 'jde-mode jde-file "JDE mode." t)
>         (setq auto-mode-alist
>               (append '(("\\.java\\'" . jde-mode)) auto-mode-alist))))
>
> Visiting a .java file correctly runs JDE mode and displays "JDE
> S/n/plugin/jdb Abbrev hs" in the mode line.
>
> However, when JDE mode is active (i.e. when there is at least one
> buffer my current buffers that is a jde-mode buffer) 100% of my CPU is
> consumed by emacs. I investigated by strace(1)ing emacs, visiting a
> JDE mode buffer, noting the CPU spike, then Ctrl-C'ing emacs, so that
> the last thing in the strace log is whatever's going on in emacs.
>
> The last lines of strace output read:
>
>     write(4, ";\0\5\0\366\1\300\0\0\0\0\0\33\0\264\0X\2\f\0C\0\5\0\201"...,
> 56) = 56
>
> and there are literally thousands of these lines in the strace output.
>
> Since it was writing (consistently across runs) to fd 4, I thought I'd
> run lsof(8) and grep for the PID of the emacs instance running JDE,
> and see what fd 4 corresponds to. It said:
>
> ,----lsof output
> | emacs     16120 db276    4u     unix 0x000001007ca40c80
>  286001 socket
> `----
>
> Interestingly, when I try to type in an emacs buffer, the CPU usage
> darts back down to normal. I can type at normal speed in a JDE buffer
> just fine. When I'm *not* typing, however, is when this occurs.
>
> _Summary_
> For some reason, JDE is loop-writing to a unix socket as fast as
> possible, when the user is doing nothing.
>
> I am currently looking at other writes to fd 4 in the strace output,
> to see if I can discern what kind of data is being stuffed into that
> file descriptor.
>
> -Denis
>