GNU bug report logs - #407
gpm server stop making emacs abort()

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Fri, 13 Jun 2008 21:05:05 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 407 in the body.
You can then email your comments to 407 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: emacs-pretest-bug <at> gnu.org
Subject: gpm server stop making emacs abort()
Date: Sat, 14 Jun 2008 06:55:33 +1000
[Message part 1 (text/plain, inline)]
If running with

	(gpm-mouse-mode 1)

and if you stop the gpm server, then emacs dies with

	Fatal error (6)Aborted

Output from "bt full" below; xbacktrace printed nothing at all.


The backtrace shows it at the abort() under the EBADF case in
wait_reading_process_output().  I think when Gpm_GetEvent gets an eof
from the server it closes gpm_fd; maybe that's the bad fd in question.


In GNU Emacs 23.0.60.1 (i586-pc-linux-gnu, GTK+ Version 2.12.10)
 of 2008-06-13 on blah.blah
configured using `configure  'CFLAGS=-O -g' '--prefix=/down/emacs/b/inst' '--with-x-toolkit=gtk''

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: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  gpm-mouse-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

[bt.txt (text/plain, attachment)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: 407 <at> debbugs.gnu.org
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 13 Jun 2008 18:18:32 -0400
> If running with
> 	(gpm-mouse-mode 1)
> and if you stop the gpm server, then emacs dies with
> 	Fatal error (6)Aborted
> Output from "bt full" below; xbacktrace printed nothing at all.

> The backtrace shows it at the abort() under the EBADF case in
> wait_reading_process_output().  I think when Gpm_GetEvent gets an eof
> from the server it closes gpm_fd; maybe that's the bad fd in question.

I can't test it right now.  Does the patch below help?


        Stefan


--- keyboard.c.~1.959.~	2008-06-03 02:14:30.000000000 -0400
+++ keyboard.c	2008-06-13 18:17:35.000000000 -0400
@@ -7189,6 +7189,8 @@
       while (gpm = Gpm_GetEvent (&event), gpm == 1) {
 	  nread += handle_one_term_event (tty, &event, &hold_quit);
       }
+      if (gpm < 0)
+	delete_gpm_wait_descriptor (gpm_fd);
       if (hold_quit.kind != NO_EVENT)
 	  kbd_buffer_store_event (&hold_quit);
       if (nread)




Tags added: moreinfo Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Tue, 01 Jul 2008 07:15:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac <at> gmx.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #17 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 407 <at> debbugs.gnu.org, Kevin Ryde <user42 <at> zip.com.au>
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Tue, 01 Jul 2008 22:43:40 +0200
[ Stefan, it seems you inadvertently forgot to CC the bug submitter,
  which is why you did not get an answer from him.]

On 2008-06-14 00:18 +0200, Stefan Monnier wrote:

>> If running with
>> 	(gpm-mouse-mode 1)
>> and if you stop the gpm server, then emacs dies with
>> 	Fatal error (6)Aborted

I also saw that. When gpm was upgraded and restarted, Emacs aborted.

>> Output from "bt full" below; xbacktrace printed nothing at all.
>
>> The backtrace shows it at the abort() under the EBADF case in
>> wait_reading_process_output().  I think when Gpm_GetEvent gets an eof
>> from the server it closes gpm_fd; maybe that's the bad fd in question.
>
> I can't test it right now.  Does the patch below help?
>
>
>         Stefan
>
>
> --- keyboard.c.~1.959.~	2008-06-03 02:14:30.000000000 -0400
> +++ keyboard.c	2008-06-13 18:17:35.000000000 -0400
> @@ -7189,6 +7189,8 @@
>        while (gpm = Gpm_GetEvent (&event), gpm == 1) {
>  	  nread += handle_one_term_event (tty, &event, &hold_quit);
>        }
> +      if (gpm < 0)
> +	delete_gpm_wait_descriptor (gpm_fd);
>        if (hold_quit.kind != NO_EVENT)
>  	  kbd_buffer_store_event (&hold_quit);
>        if (nread)

Works fine for me.

Regards,
        Sven




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #22 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Sven Joachim <svenjoac <at> gmx.de>, 407 <at> debbugs.gnu.org
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 04 Jul 2008 08:00:36 +1000
> On 2008-06-14 00:18 +0200, Stefan Monnier wrote:
>
>> Does the patch below help?

Yep.  But should it clear gpm_tty too?  It seems to need a
"(gpm-mouse-mode 0)" before a fresh "(gpm-mouse-mode 1)" will take
effect when the server is running again.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #27 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Sven Joachim <svenjoac <at> gmx.de>
Cc: 407 <at> debbugs.gnu.org, Kevin Ryde <user42 <at> zip.com.au>
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 12 Sep 2008 00:14:25 -0400
>> +      if (gpm < 0)
>> +	delete_gpm_wait_descriptor (gpm_fd);
>> if (hold_quit.kind != NO_EVENT)
>> kbd_buffer_store_event (&hold_quit);
>> if (nread)

> Works fine for me.

I've installed a similar patch.  It does not do (gpm-mouse-mode 0)
because I don't think it is safe at this point.  So there's probably
room for improvement, but it hopefully fixes the crashes.


        Stefan





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac <at> gmx.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #32 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 407 <at> debbugs.gnu.org, Kevin Ryde <user42 <at> zip.com.au>
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 12 Sep 2008 07:54:08 +0200
On 2008-09-12 06:14 +0200, Stefan Monnier wrote:

>>> +      if (gpm < 0)
>>> +	delete_gpm_wait_descriptor (gpm_fd);
>>> if (hold_quit.kind != NO_EVENT)
>>> kbd_buffer_store_event (&hold_quit);
>>> if (nread)
>
>> Works fine for me.
>
> I've installed a similar patch.  It does not do (gpm-mouse-mode 0)
> because I don't think it is safe at this point.  So there's probably
> room for improvement, but it hopefully fixes the crashes.

Indeed it fixes the crashes, but the room for improvement is rather
large, as gpm-mouse-mode does not work at all now. :-(

Sven





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #37 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Nick Roberts  <nickrob <at> snap.net.nz>, Sven Joachim <svenjoac <at> gmx.de>
Cc: 407 <at> debbugs.gnu.org, Kevin Ryde <user42 <at> zip.com.au>
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 12 Sep 2008 13:08:56 -0400
>>>> +      if (gpm < 0)
>>>> +	delete_gpm_wait_descriptor (gpm_fd);
>>>> if (hold_quit.kind != NO_EVENT)
>>>> kbd_buffer_store_event (&hold_quit);
>>>> if (nread)
>> 
>>> Works fine for me.
>> 
>> I've installed a similar patch.  It does not do (gpm-mouse-mode 0)
>> because I don't think it is safe at this point.  So there's probably
>> room for improvement, but it hopefully fixes the crashes.

> Indeed it fixes the crashes, but the room for improvement is rather
> large, as gpm-mouse-mode does not work at all now. :-(

Huh!  Indeed!  The condition "gpm < 0" is encountered all the time, so
my patch ends up turning gpm off right away.  But now I'm lost: I don't
understand what delete_gpm_wait_descriptor and add_gpm_wait_descriptor
do, because if I remove the call to add_gpm_wait_descriptor, the gpm
support seems to still work just fine.

Nick, do you have an idea what's going on?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #42 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: 407 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#407: gpm server stop making emacs abort()
Date: Fri, 31 Oct 2008 09:11:07 +1100
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> Huh!  Indeed!  The condition "gpm < 0" is encountered all the time,

Yes, EWOULDBLOCK.  gpm==0 is eof from the server.

gpm==-1 is a protocol error as well as EWOULDBLOCK, but it might be ok
to quietly ignore that.  It probably only happens if libgpm.so and the
running daemon are incompatible versions.

I get some joy from the change below.  I think the add/delete descriptor
calls might be right, but I'm not terrifically confident.

One thing I notice not done is to turn off the gpm-mouse-mode minor mode
variable when stopping like this.  Maybe that's good enough.  It won't
stop normally, so as long as emacs doesn't abort that could be enough.
(You can M-x gpm-mouse-mode twice to toggle it back on.)


[keyboard.c.gpm.diff (text/x-diff, attachment)]
[term.c.gpm.diff (text/x-diff, attachment)]
[termhooks.h.gpm.diff (text/x-diff, attachment)]
[Message part 5 (text/plain, inline)]
-- 
The sigfile one-line movie review series:
"Cold Fever" -- easily the best Japanese-Icelandic road movie ever made.

Tags removed: moreinfo Request was from Kevin Ryde <user42 <at> zip.com.au> to control <at> emacsbugs.donarmstrong.com. (Thu, 18 Dec 2008 21:05:06 GMT) Full text and rfc822 format available.

Tags added: patch Request was from Kevin Ryde <user42 <at> zip.com.au> to control <at> emacsbugs.donarmstrong.com. (Thu, 18 Dec 2008 21:05:06 GMT) Full text and rfc822 format available.

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 27 Mar 2009 16:25:04 GMT) Full text and rfc822 format available.

Notification sent to Kevin Ryde <user42 <at> zip.com.au>:
bug acknowledged by developer. (Fri, 27 Mar 2009 16:25:04 GMT) Full text and rfc822 format available.

Message #51 received at 407-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 407-done <at> debbugs.gnu.org
Subject: gpm server stop making emacs abort()
Date: Fri, 27 Mar 2009 12:18:19 -0400
Thanks Kevin for your patch.  I've tried it out and it seems to be fine,
so I installed it (at long last).
We're really relying too much on undocumented parts of the GPM API, tho.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#407; Package emacs. (Sat, 28 Mar 2009 00:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 28 Mar 2009 00:55:05 GMT) Full text and rfc822 format available.

Message #56 received at 407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: 407 <at> debbugs.gnu.org
Subject: Re: bug#407 closed by Stefan Monnier <monnier <at> iro.umontreal.ca> (gpm  server stop making emacs abort())
Date: Sat, 28 Mar 2009 11:46:14 +1100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> I've tried it out and it seems to be fine, so I installed it (at long
> last).

I'd wondered if it suffered some bit-rot in the interim (changes to
other stuff somewhere), but yes it seems to go.

> We're really relying too much on undocumented parts of the GPM API, tho.

I suspect it may be slightly geared towards a program that uses gpm all
the time and will exit if it goes away, so normally you don't care much
about a shutdown/disconnect.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Tue, 23 Jun 2009 14:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 266 days ago.

Previous Next


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