EMACS - python-mode 100% CPU usage

Bug #72867 reported by speeves on 2006-11-22
10
Affects Status Importance Assigned to Milestone
cedet (Ubuntu)
Undecided
Michael Olson

Bug Description

Binary package hint: semantic

After installing:

ii emacs-snapshot-bin-common 20060915-1 The GNU Emacs editor's shared, architecture
ii emacs-snapshot-common 20060915-1 The GNU Emacs editor's common infrastructure
ii emacs-snapshot-gtk 20060915-1 The GNU Emacs editor (with GTK+ 2.x support)
ii python-mode 1.0-2 Emacs-lisp python-mode and doctest-mode for
ii semantic 1.0pre3-1 Parser Infrastructure for Emacsen

I found that emacs was taking up 100% cpu after opening a python file for editing. I traced it down to semantic, and the following patch:

 --- semantic-idle.el 2005/09/30 20:20:43 1.34
+++ semantic-idle.el 2006/09/12 01:16:12 1.35
@@ -1,10 +1,10 @@
 ;;; semantic-idle.el --- Schedule parsing tasks in idle time

-;;; Copyright (C) 2003, 2004, 2005 Eric M. Ludlam
+;;; Copyright (C) 2003, 2004, 2005, 2006 Eric M. Ludlam

 ;; Author: Eric M. Ludlam <email address hidden>
 ;; Keywords: syntax
-;; X-RCS: $Id: semantic-idle.el,v 1.34 2005/09/30 20:20:43 zappo Exp $
+;; X-RCS: $Id: semantic-idle.el,v 1.35 2006/09/12 01:16:12 zappo Exp $

 ;; This file is not part of GNU Emacs.

@@ -286,12 +286,9 @@
   (when (zerop (recursion-depth))
     (unwind-protect
         (semantic-safe "idle error: %S"
- ;; Disable the auto parse timer while re-parsing
- (semantic-idle-scheduler-kill-timer)
           ;; Handle re-parsing and other scheduled services
           (save-match-data (semantic-idle-core-handler)))
- ;; Enable again the auto parse timer
- (semantic-idle-scheduler-setup-timer))))
+ )))

 ;;; REPARSING
 ;;

http://cedet.cvs.sourceforge.net/cedet/cedet/semantic/semantic-idle.el?r1=1.34&r2=1.35&view=patch

fixed the issue. Here is how:

1. copy the patch text into ~/downloads/semantic-idle.patch

2. sudo cp /usr/share/emacs/site-lisp/semantic/semantic-idle.el ~/downloads/

3. patch semantic-idle.el semantic-idle.patch

4. emacs -batch -f batch-byte-compile semantic-idle.el

5. sudo cp semantic-idle.el /usr/share/emacs/site-lisp/semantic/

6. sudo cp semantic-idle.elc /usr/share/emacs-snapshot/site-lisp/semantic/

7. start emacs-snapshot-gtk

I'm still unclear as to how you can recompile the /usr/share/emacs/site-lisp/semantic/*.el files, and push them out to every ${FLAVOR} of emacs, but the steps above will work for now...

speeves (speeves) wrote :

This seems to effect more than just python-mode...

https://launchpad.net/distros/ubuntu/+source/cedet/+bug/66723

Myster (kevin-weber) wrote :

When I try to patch, it returns :

patching file semantic-idle.el
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 286.
2 out of 2 hunks FAILED -- saving rejects to file semantic-idle.el.rej

It's normal ?

On 11/25/06, Myster <email address hidden> wrote:
>
> When I try to patch, it returns :
>
> patching file semantic-idle.el
> Hunk #1 FAILED at 1.
> Hunk #2 FAILED at 286.
> 2 out of 2 hunks FAILED -- saving rejects to file semantic-idle.el.rej
>
> It's normal ?
>
> --
> EMACS - python-mode 100% CPU usage
> https://launchpad.net/bugs/72867
>

It fails on hunk #1, but this is only file and author information.

It probably failed on hunk #2, because you didn't have permissions to write
to the file. Did you copy it to your home dir? (You can do it on the
original in /usr/share... as sudo, but I would backup the original before
performing this operation).

--
Shannon Eric Peevey
<email address hidden>
http://speeves.unt.edu

Myster (kevin-weber) wrote :

But I've permissions to write to this file ?
Another idea ?

Myster (kevin-weber) wrote :

semantic-idle.el.rej:

***************
*** 286,297 ****
    (when (zerop (recursion-depth))
      (unwind-protect
          (semantic-safe "idle error: %S"
- ;; Disable the auto parse timer while re-parsing
- (semantic-idle-scheduler-kill-timer)
            ;; Handle re-parsing and other scheduled services
            (save-match-data (semantic-idle-core-handler)))
- ;; Enable again the auto parse timer
- (semantic-idle-scheduler-setup-timer))))

  ;;; REPARSING
  ;;
--- 286,294 ----
    (when (zerop (recursion-depth))
      (unwind-protect
          (semantic-safe "idle error: %S"
            ;; Handle re-parsing and other scheduled services
            (save-match-data (semantic-idle-core-handler)))
+ )))

  ;;; REPARSING
  ;;

It's the rejects but I don't understand.

speeves (speeves) wrote :

On 11/25/06, Myster <email address hidden> wrote:
>
> semantic-idle.el.rej:
>
> ***************
> *** 286,297 ****
> (when (zerop (recursion-depth))
> (unwind-protect
> (semantic-safe "idle error: %S"
> - ;; Disable the auto parse timer while re-parsing
> - (semantic-idle-scheduler-kill-timer)
> ;; Handle re-parsing and other scheduled services
> (save-match-data (semantic-idle-core-handler)))
> - ;; Enable again the auto parse timer
> - (semantic-idle-scheduler-setup-timer))))
>
> ;;; REPARSING
> ;;
> --- 286,294 ----
> (when (zerop (recursion-depth))
> (unwind-protect
> (semantic-safe "idle error: %S"
> ;; Handle re-parsing and other scheduled services
> (save-match-data (semantic-idle-core-handler)))
> + )))
>
> ;;; REPARSING
> ;;
>
> It's the rejects but I don't understand.

Can you send the your exact commands and output? that might give us some
insight into the issue.

thanks,

--
Shannon Eric Peevey
<email address hidden>
http://speeves.unt.edu

Myster (kevin-weber) wrote :

myster@laptop:~/dowloads$patch semantic-idle.el semantic-idle.patch

patching file semantic-idle.el
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 286.
2 out of 2 hunks FAILED -- saving rejects to file semantic-idle.el.rej

It's everything
And I gave you the result of "semantic-idle.el.rej"
Thanks you for your help.

speeves (speeves) wrote :

On 11/26/06, Myster <email address hidden> wrote:
>
> myster@laptop:~/dowloads$patch semantic-idle.el semantic-idle.patch
>
> patching file semantic-idle.el
> Hunk #1 FAILED at 1.
> Hunk #2 FAILED at 286.
> 2 out of 2 hunks FAILED -- saving rejects to file semantic-idle.el.rej

And, can you run:

myster@laptop:~/dowloads$ ls -l semantic-idle*

thanks,

--
Shannon Eric Peevey
<email address hidden>
http://speeves.unt.edu

Myster (kevin-weber) wrote :

myster@laptop:~/downloads$ ls -l semantic-idle*
-rw------- 1 pep pep 24654 2006-11-25 21:45 semantic-idle.el
-rw------- 1 pep pep 24654 2006-11-25 21:44 semantic-idle.el.orig
-rw------- 1 pep pep 1389 2006-11-25 21:45 semantic-idle.el.rej
-rwx------ 1 pep pep 970 2006-11-25 17:02 semantic-idle.patch
-rw------- 1 pep pep 1036 2006-11-25 16:55 semantic-idle.patch~

speeves (speeves) wrote :

On 11/26/06, Myster <email address hidden> wrote:
>
> myster@laptop:~/downloads$ ls -l semantic-idle*
> -rw------- 1 pep pep 24654 2006-11-25 21:45 semantic-idle.el
> -rw------- 1 pep pep 24654 2006-11-25 21:44 semantic-idle.el.orig
> -rw------- 1 pep pep 1389 2006-11-25 21:45 semantic-idle.el.rej
> -rwx------ 1 pep pep 970 2006-11-25 17:02 semantic-idle.patch
> -rw------- 1 pep pep 1036 2006-11-25 16:55 semantic-idle.patch~
>
> --
> EMACS - python-mode 100% CPU usage
> https://launchpad.net/bugs/72867
>
did you try sudo patch... ?

--
Shannon Eric Peevey
<email address hidden>
http://speeves.unt.edu

Myster (kevin-weber) wrote :

Yes, it's the same errors
Thanks,

Michael Gratton (mjog) wrote :

This changes in this patch (when it is applied) fixes this problem.

Changed in cedet:
status: Unconfirmed → Confirmed
Michael Olson (mwolson) wrote :

This is fixed in gutsy.

Changed in cedet:
status: Confirmed → Fix Released
Michael Olson (mwolson) wrote :

Actually, it doesn't quite seem to be fixed due to a packaging mistake. In a bit, I will attach a debdiff for a ubuntu-specific version that really fixes it.

Michael Olson (mwolson) on 2007-07-05
Changed in cedet:
status: Fix Released → In Progress
Changed in cedet:
assignee: nobody → mwolson-member
Michael Olson (mwolson) wrote :

Marked as a duplicate of #93667, since it wil be fixed once the new cedet package gets synced from Debian.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers