unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* run-python hangs for some versions
@ 2007-06-17 10:15 adam
  2007-06-18  7:25 ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: adam @ 2007-06-17 10:15 UTC (permalink / raw)
  To: bug-gnu-emacs

For some versions of python the run-python (provided by python.el)
command will completely hang emacs.  There is no option but to kill
the process.  I'm changing the python version this way:

(custom-set-variables 
'(python-python-command "/home/adam/python3/bin/python")
)

This works correctly with python 2.4 and 2.5, but hangs with 2.2 and
3.0 (from svn).  strace reports that emacs is running the following
syscall over and over again:

select(5, [3 4], NULL, NULL, {4, 999110}) = 0 (Timeout)

This does not happen with the old python-mode in emacs 21.




In GNU Emacs 22.1.1 (i686-pc-linux-gnu)
 of 2007-06-17 on hupp
configured using `configure  '--prefix=/home/adam/opt/emacs22''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  global-pair-mode: t
  show-paren-mode: t
  icomplete-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC x r e p o TAB TAB r t - e m TAB RET

Recent messages:
Loading paren...done
Loading easy-mmode...done
Loading regexp-opt...done
Loading edmacro...done
Loading cl-macs...done
Loading /home/adam/dotfiles/elisp/themes/color-theme-library.el (source)...done
For information about the GNU Project and its goals, type C-h C-p.
Making completion list...
Loading help-mode...done
Loading emacsbug...done

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

* Re: run-python hangs for some versions
  2007-06-17 10:15 adam
@ 2007-06-18  7:25 ` Richard Stallman
  2007-06-18 10:46   ` Adam Hupp
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-06-18  7:25 UTC (permalink / raw)
  To: adam; +Cc: bug-gnu-emacs

    This works correctly with python 2.4 and 2.5, but hangs with 2.2 and
    3.0 (from svn).  strace reports that emacs is running the following
    syscall over and over again:

    select(5, [3 4], NULL, NULL, {4, 999110}) = 0 (Timeout)

If you want to get real info, use GDB, not strace.
strace gives no useful info.

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

* Re: run-python hangs for some versions
  2007-06-18  7:25 ` Richard Stallman
@ 2007-06-18 10:46   ` Adam Hupp
  2007-06-19 10:40     ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Hupp @ 2007-06-18 10:46 UTC (permalink / raw)
  To: Richard Stallman; +Cc: bug-gnu-emacs

On Mon, Jun 18, 2007 at 03:25:27AM -0400, Richard Stallman wrote:
> If you want to get real info, use GDB, not strace.
> strace gives no useful info.

Here's the bt:

#0  0x401369a2 in select () from /lib/libc.so.6
#1  0x08317619 in ?? ()
#2  0x0818789a in close_process_descs () at process.c:3906
#3  0x08188bdc in wait_reading_process_output (time_limit=5,
#microsecs=0,
    read_kbd=0, do_display=0, wait_for_cell=137459225,
#wait_proc=0x8783f78,
    just_wait_proc=0) at process.c:4594
#4  0x08187a95 in Faccept_process_output (process=142098300,
#seconds=40,
    millisec=137459225, just_this_one=137459225) at process.c:3966
#5  0x081478bb in Ffuncall (nargs=3, args=0xbfffe860) at eval.c:3007
#6  0x0817f1e2 in Fbyte_code (bytestr=141710803, vector=141716188,
#maxdepth=24)
    at bytecode.c:679
#7  0x08147ff1 in funcall_lambda (fun=141716340, nargs=1,
    arg_vector=0xbfffeb64) at eval.c:3184
#8  0x08147ab1 in Ffuncall (nargs=2, args=0xbfffeb60) at eval.c:3043
#9  0x0817f1e2 in Fbyte_code (bytestr=141709579, vector=140384932,
#maxdepth=56)
    at bytecode.c:679
#10 0x08147ff1 in funcall_lambda (fun=140385276, nargs=1,
    arg_vector=0xbfffeef4) at eval.c:3184
#11 0x08147ab1 in Ffuncall (nargs=2, args=0xbfffeef0) at eval.c:3043
#12 0x08146e15 in Fapply (nargs=2, args=0xbfffeef0) at eval.c:2430
#13 0x081473ba in apply1 (fn=138160505, arg=141944627) at eval.c:2749
#14 0x08141b6b in Fcall_interactively (function=138160505,
    record_flag=137459273, keys=137499492) at callint.c:406
#15 0x080d11c4 in Fcommand_execute (cmd=138160505,
#record_flag=137459273,
    keys=137459225, special=137459225) at keyboard.c:10036
#16 0x080d151c in Fexecute_extended_command (prefixarg=137459225)
    at keyboard.c:10152
#17 0x08147822 in Ffuncall (nargs=2, args=0xbffff320) at eval.c:2997
#18 0x081433a2 in Fcall_interactively (function=137497817,
    record_flag=137459225, keys=137499492) at callint.c:860
#19 0x080d11c4 in Fcommand_execute (cmd=137497817,
#record_flag=137459225,
    keys=137459225, special=137459225) at keyboard.c:10036
#20 0x080c50d2 in command_loop_1 () at keyboard.c:1873
#21 0x08145465 in internal_condition_case (bfun=0x80c3d56
#<command_loop_1>,
    handlers=137504537, hfun=0x80c386f <cmd_error>) at eval.c:1481
#22 0x080c3bed in command_loop_2 () at keyboard.c:1329
#23 0x08144f33 in internal_catch (tag=137497697,
    func=0x80c3bca <command_loop_2>, arg=137459225) at eval.c:1222
#24 0x080c3ba3 in command_loop () at keyboard.c:1308
#25 0x080c3699 in recursive_edit_1 () at keyboard.c:1006
#26 0x080c37c1 in Frecursive_edit () at keyboard.c:1067
#27 0x080c2105 in main (argc=3, argv=0xbffffda4) at emacs.c:1762

Lisp Backtrace:
"accept-process-output" (0x8783f7c)
"python-send-receive" (0x872519b)
"run-python" (0x875e733)
"call-interactively" (0x83c2979)
"execute-extended-command" (0x8317619)
"call-interactively" (0x8320cd9)

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

* Re: run-python hangs for some versions
       [not found] <mailman.2279.1182076226.32220.bug-gnu-emacs@gnu.org>
@ 2007-06-19  5:52 ` Stefan Monnier
  2007-06-19  7:51   ` Adam Hupp
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2007-06-19  5:52 UTC (permalink / raw)
  To: adam; +Cc: bug-gnu-emacs

> This works correctly with python 2.4 and 2.5, but hangs with 2.2 and
> 3.0 (from svn).  strace reports that emacs is running the following
> syscall over and over again:

> select(5, [3 4], NULL, NULL, {4, 999110}) = 0 (Timeout)

> This does not happen with the old python-mode in emacs 21.

Most likely it's stuck in the

  (python-send-receive "import emacs; print '_emacs_out ()'")

in run-python.  This is supposed to send the above command to python and
than wait for Python to reply by outputting "_emacs_out ()\n".
The `emacs' package is in ..emacs/etc/emacs.py.
Can you take a look at the *python* buffer see if it says something useful.
Or else take a look at ..emacs/etc/emacs.py and try to figure out why it's
not working right.


        Stefan

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

* Re: run-python hangs for some versions
  2007-06-19  5:52 ` run-python hangs for some versions Stefan Monnier
@ 2007-06-19  7:51   ` Adam Hupp
  2007-06-19 14:06     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Hupp @ 2007-06-19  7:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: bug-gnu-emacs

On Tue, Jun 19, 2007 at 01:52:04AM -0400, Stefan Monnier wrote:
> > This works correctly with python 2.4 and 2.5, but hangs with 2.2 and
> > 3.0 (from svn).  strace reports that emacs is running the following
> > syscall over and over again:
> 
> > select(5, [3 4], NULL, NULL, {4, 999110}) = 0 (Timeout)
> 
> > This does not happen with the old python-mode in emacs 21.
> 
> Most likely it's stuck in the
> 
>   (python-send-receive "import emacs; print '_emacs_out ()'")

Thanks for the pointer.  It looks like the problem is that Python 3
has some syntactic changes that break both emacs.py and the above
statement.  With updates for the syntax changes (print and eval are
now functions) it does work fine.

I'll try to come up with a fix that works across versions.  

-Adam

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

* Re: run-python hangs for some versions
  2007-06-18 10:46   ` Adam Hupp
@ 2007-06-19 10:40     ` Richard Stallman
  2007-06-21  5:29       ` Adam Hupp
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-06-19 10:40 UTC (permalink / raw)
  To: Adam Hupp; +Cc: bug-gnu-emacs

    #0  0x401369a2 in select () from /lib/libc.so.6
    #1  0x08317619 in ?? ()
    #2  0x0818789a in close_process_descs () at process.c:3906

That is very strange -- it doesn't seem to fit the code in process.c.

We need to find out what is calling `select' and why.
So you need to study the machine code against the source code.
Is frame #1 emacs_close, or what?

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

* Re: run-python hangs for some versions
  2007-06-19  7:51   ` Adam Hupp
@ 2007-06-19 14:06     ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2007-06-19 14:06 UTC (permalink / raw)
  To: Adam Hupp; +Cc: bug-gnu-emacs

>> > This works correctly with python 2.4 and 2.5, but hangs with 2.2 and
>> > 3.0 (from svn).  strace reports that emacs is running the following
>> > syscall over and over again:
>> 
>> > select(5, [3 4], NULL, NULL, {4, 999110}) = 0 (Timeout)
>> 
>> > This does not happen with the old python-mode in emacs 21.
>> 
>> Most likely it's stuck in the
>> 
>> (python-send-receive "import emacs; print '_emacs_out ()'")

> Thanks for the pointer.  It looks like the problem is that Python 3
> has some syntactic changes that break both emacs.py and the above
> statement.  With updates for the syntax changes (print and eval are
> now functions) it does work fine.

> I'll try to come up with a fix that works across versions.  

That would be very helpful, thank you.


        Stefan

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

* Re: run-python hangs for some versions
  2007-06-19 10:40     ` Richard Stallman
@ 2007-06-21  5:29       ` Adam Hupp
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Hupp @ 2007-06-21  5:29 UTC (permalink / raw)
  To: Richard Stallman; +Cc: bug-gnu-emacs

On Tue, Jun 19, 2007 at 06:40:41AM -0400, Richard Stallman wrote:
>     #0  0x401369a2 in select () from /lib/libc.so.6
>     #1  0x08317619 in ?? ()
>     #2  0x0818789a in close_process_descs () at process.c:3906
> 
> That is very strange -- it doesn't seem to fit the code in process.c.
> 
> We need to find out what is calling `select' and why.
> So you need to study the machine code against the source code.
> Is frame #1 emacs_close, or what?

I put a breakpoint in emacs_close but for some reason it went into
abort instead.

However, Stefan Monnier suggested[0] that this line of python.el may
be the cause:
  
  (python-send-receive "import emacs; print '_emacs_out ()'")

This is correct.  python-send-receive loops forever waiting for the
"_emacs_out" to be printed, which it isn't because of an
incompatibility with python 3000.

-Adam

[0] http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-06/msg00196.html

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

end of thread, other threads:[~2007-06-21  5:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2279.1182076226.32220.bug-gnu-emacs@gnu.org>
2007-06-19  5:52 ` run-python hangs for some versions Stefan Monnier
2007-06-19  7:51   ` Adam Hupp
2007-06-19 14:06     ` Stefan Monnier
2007-06-17 10:15 adam
2007-06-18  7:25 ` Richard Stallman
2007-06-18 10:46   ` Adam Hupp
2007-06-19 10:40     ` Richard Stallman
2007-06-21  5:29       ` Adam Hupp

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).