GNU bug report logs - #70544
30.0.50; The primitive-function "call-process-region" returns "internal error" and causes high cpu usage on win10

Previous Next

Package: emacs;

Reported by: leuven65 <leuven65 <at> gmail.com>

Date: Wed, 24 Apr 2024 01:52:13 UTC

Severity: normal

Tags: moreinfo

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70544 in the body.
You can then email your comments to 70544 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70544; Package emacs. (Wed, 24 Apr 2024 01:52:16 GMT) Full text and rfc822 format available.

Acknowledgement sent to leuven65 <leuven65 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 24 Apr 2024 01:52:17 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: leuven65 <leuven65 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; The primitive-function "call-process-region" returns
 "internal error" and causes high cpu usage on win10
Date: Tue, 23 Apr 2024 20:02:39 +0200
[Message part 1 (text/plain, inline)]
On windows10, I uses git for windows, but when I execute "gitk" by
"shell-command"
in emacs, it returns an error "internal error",
and emacs's cpu usage becomes full forever, except for restarting emacs,
It seems emacs might process something wrong in this case.

The issue can be easily reproduced by directly eval following sexp:

(call-process-region (point-min) (point-max)
                     "cmdproxy.exe"
                     t
                     t
                     nil
                     "-c"
                     "gitk")
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70544; Package emacs. (Wed, 24 Apr 2024 06:09:06 GMT) Full text and rfc822 format available.

Message #8 received at 70544 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: leuven65 <leuven65 <at> gmail.com>
Cc: 70544 <at> debbugs.gnu.org
Subject: Re: bug#70544: 30.0.50;
 The primitive-function "call-process-region" returns "internal error"
 and causes high cpu usage on win10
Date: Wed, 24 Apr 2024 09:07:53 +0300
> From: leuven65 <leuven65 <at> gmail.com>
> Date: Tue, 23 Apr 2024 20:02:39 +0200
> 
> On windows10, I uses git for windows, but when I execute "gitk" by "shell-command" 
> in emacs, it returns an error "internal error", 
> and emacs's cpu usage becomes full forever, except for restarting emacs,

I cannot reproduce this.  But my Git for Windows is quite old, so
maybe newer versions made some change?  What is gitk on your machine?
Is it a gitk.exe program or some kind of script?

> The issue can be easily reproduced by directly eval following sexp:
> 
> (call-process-region (point-min) (point-max)
>                      "cmdproxy.exe"
>                      t
>                      t
>                      nil
>                      "-c"
>                      "gitk")

gitk is a GUI program, so why are you invoking it with
call-process-region?  gitk will never read anything from its stdin or
write anything to its stdout.  I suggest to invoke gitk from Emacs
like this:

  M-! gitk & RET

IOW, add the "&" character at the end of the command line to make the
invocation asynchronous, instead of letting Emacs block until gitk
exits.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70544; Package emacs. (Wed, 24 Apr 2024 08:13:10 GMT) Full text and rfc822 format available.

Message #11 received at 70544 <at> debbugs.gnu.org (full text, mbox):

From: leuven65 <leuven65 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70544 <at> debbugs.gnu.org
Subject: Re: bug#70544: 30.0.50; The primitive-function "call-process-region"
 returns "internal error" and causes high cpu usage on win10
Date: Wed, 24 Apr 2024 10:12:10 +0200
[Message part 1 (text/plain, inline)]
I use the latest version "[[
https://github.com/git-for-windows/git/releases/tag/v2.44.0.windows.1]]",
in which "a couple of
bugs that could cause Git Bash to hang in certain scenarios were fixed", it
might cause the exit behavior of "gitk.exe"
changed.

The program gitk is "${git-installation-folder}/cmd/gitk.exe".

The issue only pops up when I set "(setq-default shell-file-name
"cmdproxy.exe")", if set to "bash.exe", no such
problem.

When the issue happens, emacs is not blocked, I can smoothly input in
emacs, but the cpu usage of emacs is very high
forever. As I built emacs without debug information, what I can see so far
is that most of time seems to be spent on
"MsgWaitForMultipleObjects".

I use "shell-command" (M-!) to run "gitk.exe", the correct behavior is to
run "gitk" and block emacs, or exit with
error, in my case, it prints out error "(Shell command killed by signal
internal error)" and cpu usage goes up.

From the call stack, "shell-command" calls "call-process-region":
#+begin_quote
Debugger entered--entering a function:
,* call-process-region(324 324 "cmdproxy.exe" nil #<buffer *Shell Command
Output*> nil "-c" "gitk.exe")
  apply(call-process-region 324 324 "cmdproxy.exe" (nil #<buffer *Shell
Command Output*> nil "-c" "gitk.exe"))
  call-shell-region(324 324 "gitk.exe" nil #<buffer *Shell Command Output*>)
  shell-command-on-region(324 324 "gitk.exe" nil nil nil)
  shell-command("gitk.exe" nil nil)
  funcall-interactively(shell-command "gitk.exe" nil nil)
  command-execute(shell-command)
#+end_quote

On Wed, Apr 24, 2024 at 8:07 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: leuven65 <leuven65 <at> gmail.com>
> > Date: Tue, 23 Apr 2024 20:02:39 +0200
> >
> > On windows10, I uses git for windows, but when I execute "gitk" by
> "shell-command"
> > in emacs, it returns an error "internal error",
> > and emacs's cpu usage becomes full forever, except for restarting emacs,
>
> I cannot reproduce this.  But my Git for Windows is quite old, so
> maybe newer versions made some change?  What is gitk on your machine?
> Is it a gitk.exe program or some kind of script?
>
> > The issue can be easily reproduced by directly eval following sexp:
> >
> > (call-process-region (point-min) (point-max)
> >                      "cmdproxy.exe"
> >                      t
> >                      t
> >                      nil
> >                      "-c"
> >                      "gitk")
>
> gitk is a GUI program, so why are you invoking it with
> call-process-region?  gitk will never read anything from its stdin or
> write anything to its stdout.  I suggest to invoke gitk from Emacs
> like this:
>
>   M-! gitk & RET
>
> IOW, add the "&" character at the end of the command line to make the
> invocation asynchronous, instead of letting Emacs block until gitk
> exits.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70544; Package emacs. (Wed, 24 Apr 2024 08:26:04 GMT) Full text and rfc822 format available.

Message #14 received at 70544 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: leuven65 <leuven65 <at> gmail.com>
Cc: 70544 <at> debbugs.gnu.org
Subject: Re: bug#70544: 30.0.50; The primitive-function "call-process-region"
 returns "internal error" and causes high cpu usage on win10
Date: Wed, 24 Apr 2024 11:25:15 +0300
> From: leuven65 <leuven65 <at> gmail.com>
> Date: Wed, 24 Apr 2024 10:12:10 +0200
> Cc: 70544 <at> debbugs.gnu.org
> 
> I use the latest version
> "[[https://github.com/git-for-windows/git/releases/tag/v2.44.0.windows.1]]",
> in which "a couple of bugs that could cause Git Bash to hang in
> certain scenarios were fixed", it might cause the exit behavior of
> "gitk.exe" changed.
> 
> The program gitk is "${git-installation-folder}/cmd/gitk.exe".
> 
> The issue only pops up when I set "(setq-default shell-file-name "cmdproxy.exe")", if set to "bash.exe", no such
> problem.

Maybe this gitk was supposed to be invoked only from the MSYS Bash?
If so, this is not really a problem with Emacs.

> When the issue happens, emacs is not blocked, I can smoothly input
> in emacs, but the cpu usage of emacs is very high forever. As I
> built emacs without debug information, what I can see so far is that
> most of time seems to be spent on "MsgWaitForMultipleObjects".
> 
> I use "shell-command" (M-!) to run "gitk.exe", the correct behavior is to run "gitk" and block emacs, or exit with
> error, in my case, it prints out error "(Shell command killed by signal internal error)" and cpu usage goes up.

I guess these all are related to the fact that gitk is not a console
problem, but a GUI problem, and therefore should not be invoked from
shell-command, at least not safely.  It was probably meant to be
invoked from a shell directly, and perhaps specifically from the MSYS
Bash which comes with Git for Windows.

Bottom line: I'm not convinced this is an Emacs problem, and I still
don't understand why you gitk from Emacs in this manner.

In any case, to do anything with this problem, we need either a way to
reproduce it on the system of one of our developers, or a detailed
information regarding the reasons why Emacs is spinning calling
MsgWaitForMultipleObjects.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70544; Package emacs. (Thu, 09 May 2024 07:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 70544 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: leuven65 <at> gmail.com
Cc: 70544 <at> debbugs.gnu.org
Subject: Re: bug#70544: 30.0.50;
 The primitive-function "call-process-region" returns "internal error"
 and causes high cpu usage on win10
Date: Thu, 09 May 2024 10:16:12 +0300
tags 70544 moreinfo
thanks

Ping!  Can anyone reproduce this and/or tell more about what gitk.exe
wants and why it fails?

If no additional information emerges in a two-weeks time, I will close
this bug due to lack of sufficient information.

> Cc: 70544 <at> debbugs.gnu.org
> Date: Wed, 24 Apr 2024 11:25:15 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > From: leuven65 <leuven65 <at> gmail.com>
> > Date: Wed, 24 Apr 2024 10:12:10 +0200
> > Cc: 70544 <at> debbugs.gnu.org
> > 
> > I use the latest version
> > "[[https://github.com/git-for-windows/git/releases/tag/v2.44.0.windows.1]]",
> > in which "a couple of bugs that could cause Git Bash to hang in
> > certain scenarios were fixed", it might cause the exit behavior of
> > "gitk.exe" changed.
> > 
> > The program gitk is "${git-installation-folder}/cmd/gitk.exe".
> > 
> > The issue only pops up when I set "(setq-default shell-file-name "cmdproxy.exe")", if set to "bash.exe", no such
> > problem.
> 
> Maybe this gitk was supposed to be invoked only from the MSYS Bash?
> If so, this is not really a problem with Emacs.
> 
> > When the issue happens, emacs is not blocked, I can smoothly input
> > in emacs, but the cpu usage of emacs is very high forever. As I
> > built emacs without debug information, what I can see so far is that
> > most of time seems to be spent on "MsgWaitForMultipleObjects".
> > 
> > I use "shell-command" (M-!) to run "gitk.exe", the correct behavior is to run "gitk" and block emacs, or exit with
> > error, in my case, it prints out error "(Shell command killed by signal internal error)" and cpu usage goes up.
> 
> I guess these all are related to the fact that gitk is not a console
> problem, but a GUI problem, and therefore should not be invoked from
> shell-command, at least not safely.  It was probably meant to be
> invoked from a shell directly, and perhaps specifically from the MSYS
> Bash which comes with Git for Windows.
> 
> Bottom line: I'm not convinced this is an Emacs problem, and I still
> don't understand why you gitk from Emacs in this manner.
> 
> In any case, to do anything with this problem, we need either a way to
> reproduce it on the system of one of our developers, or a detailed
> information regarding the reasons why Emacs is spinning calling
> MsgWaitForMultipleObjects.
> 
> 
> 
> 




Added tag(s) moreinfo. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 09 May 2024 07:17:02 GMT) Full text and rfc822 format available.

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 25 May 2024 07:42:02 GMT) Full text and rfc822 format available.

Notification sent to leuven65 <leuven65 <at> gmail.com>:
bug acknowledged by developer. (Sat, 25 May 2024 07:42:02 GMT) Full text and rfc822 format available.

Message #24 received at 70544-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: leuven65 <at> gmail.com
Cc: 70544-done <at> debbugs.gnu.org
Subject: Re: bug#70544: 30.0.50;
 The primitive-function "call-process-region" returns "internal error"
 and causes high cpu usage on win10
Date: Sat, 25 May 2024 10:40:48 +0300
> Cc: 70544 <at> debbugs.gnu.org
> Date: Thu, 09 May 2024 10:16:12 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> tags 70544 moreinfo
> thanks
> 
> Ping!  Can anyone reproduce this and/or tell more about what gitk.exe
> wants and why it fails?
> 
> If no additional information emerges in a two-weeks time, I will close
> this bug due to lack of sufficient information.

No further comments, so I'm closing this bug.  If new information
emerges, please reopen and continue the discussion of possible fixes.

> 
> > Cc: 70544 <at> debbugs.gnu.org
> > Date: Wed, 24 Apr 2024 11:25:15 +0300
> > From: Eli Zaretskii <eliz <at> gnu.org>
> > 
> > > From: leuven65 <leuven65 <at> gmail.com>
> > > Date: Wed, 24 Apr 2024 10:12:10 +0200
> > > Cc: 70544 <at> debbugs.gnu.org
> > > 
> > > I use the latest version
> > > "[[https://github.com/git-for-windows/git/releases/tag/v2.44.0.windows.1]]",
> > > in which "a couple of bugs that could cause Git Bash to hang in
> > > certain scenarios were fixed", it might cause the exit behavior of
> > > "gitk.exe" changed.
> > > 
> > > The program gitk is "${git-installation-folder}/cmd/gitk.exe".
> > > 
> > > The issue only pops up when I set "(setq-default shell-file-name "cmdproxy.exe")", if set to "bash.exe", no such
> > > problem.
> > 
> > Maybe this gitk was supposed to be invoked only from the MSYS Bash?
> > If so, this is not really a problem with Emacs.
> > 
> > > When the issue happens, emacs is not blocked, I can smoothly input
> > > in emacs, but the cpu usage of emacs is very high forever. As I
> > > built emacs without debug information, what I can see so far is that
> > > most of time seems to be spent on "MsgWaitForMultipleObjects".
> > > 
> > > I use "shell-command" (M-!) to run "gitk.exe", the correct behavior is to run "gitk" and block emacs, or exit with
> > > error, in my case, it prints out error "(Shell command killed by signal internal error)" and cpu usage goes up.
> > 
> > I guess these all are related to the fact that gitk is not a console
> > problem, but a GUI problem, and therefore should not be invoked from
> > shell-command, at least not safely.  It was probably meant to be
> > invoked from a shell directly, and perhaps specifically from the MSYS
> > Bash which comes with Git for Windows.
> > 
> > Bottom line: I'm not convinced this is an Emacs problem, and I still
> > don't understand why you gitk from Emacs in this manner.
> > 
> > In any case, to do anything with this problem, we need either a way to
> > reproduce it on the system of one of our developers, or a detailed
> > information regarding the reasons why Emacs is spinning calling
> > MsgWaitForMultipleObjects.
> > 
> > 
> > 
> > 
> 
> 
> 
> 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 22 Jun 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.