unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs exited with message “X protocol error: BadPixmap”
@ 2007-08-12  1:20 Joe Wells
  2007-08-12 17:56 ` Richard Stallman
  0 siblings, 1 reply; 13+ messages in thread
From: Joe Wells @ 2007-08-12  1:20 UTC (permalink / raw)
  To: bug-gnu-emacs

I'm using Emacs 22.1.  Emacs suddenly exited (with no core dump file
to be found).  It seems it left this message on stderr:

  X protocol error: BadPixmap (invalid Pixmap parameter) on protocol request 55

A similar crash happened just a bit earlier.  Only the second time did
I see the error message.  I think the first time stderr had been
disconnected from any useful file/tty, so I'm not sure if the same
error message was there for the first crash.

It is troublesome that there is no core dump file.  I checked that
core dumps are enabled, so that is not the problem.  It seems to me
that it would be helpful if Emacs aborted to leave a core dump file in
this case.

How do I debug this if it happens again?  (Please don't tell me to
always run Emacs under gdb!)

Other details below (from a fresh Emacs invocation obviously).

Joe

P.S.  There is only one unusual thing I've done in the last day that I
can think of that seems like it could trigger a crash.  The problem
*might* have something to do with using the MPH 2B Damase font in
Ubuntu (i.e., Debian) package ttf-mph-2b-damase.  I use it like this
to substitute more readable glyphs for some characters:

  (set-fontset-font "fontset-startup" 342486 '("mark-mph" . "iso10646-1")); U+2056 “⁖” THREE DOT PUNCTUATION
  (set-fontset-font "fontset-startup" 342488 '("mark-mph" . "iso10646-1")); U+2058 “⁘” FOUR DOT PUNCTUATION
  (set-fontset-font "fontset-startup" 342489 '("mark-mph" . "iso10646-1")); U+2059 “⁙” FIVE DOT PUNCTUATION

Notes:  (1) I have been doing the same thing for more than a year for
lots of other characters from other fonts with no trouble at all.
(2) Only ASCII characters are visible on the screen at the time of the
crash.  (3) The crash happens some time _after_ the above expressions
are evaluated.  Overall, it is not clear if there is a connection.

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' '--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''

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

Minor modes in effect:
  shell-dirtrack-mode: t
  outline-minor-mode: t
  url-handler-mode: t
  partial-completion-mode: t
  tooltip-mode: t
  mouse-wheel-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
  temp-buffer-resize-mode: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-12  1:20 Emacs exited with message “X protocol error: BadPixmap” Joe Wells
@ 2007-08-12 17:56 ` Richard Stallman
  2007-08-12 18:17   ` Joe Wells
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2007-08-12 17:56 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

To debug an X protocol error, you need to do (x-synchronize t).
That way xlib detects the error inside the primitive that failed.
Normally it finds out about the error later on, inside
some other primitive, so the backtrace is irrelevant to the cause
of the error.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-12 17:56 ` Richard Stallman
@ 2007-08-12 18:17   ` Joe Wells
  2007-08-13  5:01     ` Richard Stallman
  0 siblings, 1 reply; 13+ messages in thread
From: Joe Wells @ 2007-08-12 18:17 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs

Richard Stallman <rms@gnu.org> writes:

> To debug an X protocol error, you need to do (x-synchronize t).
> That way xlib detects the error inside the primitive that failed.
> Normally it finds out about the error later on, inside
> some other primitive, so the backtrace is irrelevant to the cause
> of the error.

Thanks very much for this information!

>From reading the code, it is not clear whether this is enough to also
get core dump files from these errors.  What would I need to do to
ensure that such a crash produced a core dump file?

-- 
Joe

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-12 18:17   ` Joe Wells
@ 2007-08-13  5:01     ` Richard Stallman
  2007-08-13  5:20       ` Joe Wells
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2007-08-13  5:01 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

    >From reading the code, it is not clear whether this is enough to also
    get core dump files from these errors.  What would I need to do to
    ensure that such a crash produced a core dump file?

I don't know, but you should run under GDB and put in a breakpoint
so that you can debug the error with the most flexibility.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13  5:01     ` Richard Stallman
@ 2007-08-13  5:20       ` Joe Wells
  2007-08-13 19:41         ` Eli Zaretskii
  2007-08-14  0:27         ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Joe Wells @ 2007-08-13  5:20 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs

Richard Stallman <rms@gnu.org> writes:

>     >From reading the code, it is not clear whether this is enough to also
>     get core dump files from these errors.  What would I need to do to
>     ensure that such a crash produced a core dump file?
>
> I don't know, but you should run under GDB and put in a breakpoint
> so that you can debug the error with the most flexibility.

Sorry, I'm not going to run Emacs under GDB indefinitely just on the
off chance Emacs will crash.  I depend on programs to leave core dump
files when they crash.

-- 
Joe

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13  5:20       ` Joe Wells
@ 2007-08-13 19:41         ` Eli Zaretskii
  2007-08-13 20:41           ` Joe Wells
  2007-08-14  0:27         ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2007-08-13 19:41 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs, rms

> From: Joe Wells <jbw@macs.hw.ac.uk>
> Date: Mon, 13 Aug 2007 06:20:53 +0100
> Cc: bug-gnu-emacs@gnu.org
> 
> Sorry, I'm not going to run Emacs under GDB indefinitely just on the
> off chance Emacs will crash.

Why not?  As long as Emacs doesn't crash, you will not notice any
difference in behavior or performance--GDB is simply invisible until
there's some event that is noteworthy for the debugger.

> I depend on programs to leave core dump files when they crash.

Debugging a core file has limitations that debugging a live program
(even if it crashed) does not.  Some of the GDB features do not work
with core files.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13 19:41         ` Eli Zaretskii
@ 2007-08-13 20:41           ` Joe Wells
  2007-08-14  0:28             ` Richard Stallman
  2007-08-14  3:07             ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Joe Wells @ 2007-08-13 20:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: bug-gnu-emacs, rms

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joe Wells <jbw@macs.hw.ac.uk>
>> Date: Mon, 13 Aug 2007 06:20:53 +0100
>> Cc: bug-gnu-emacs@gnu.org
>> 
>> Sorry, I'm not going to run Emacs under GDB indefinitely just on the
>> off chance Emacs will crash.
>
> Why not?  As long as Emacs doesn't crash, you will not notice any
> difference in behavior or performance--GDB is simply invisible until
> there's some event that is noteworthy for the debugger.

I'm not going to run every program on my system under the debugger
forevermore on the off chance that the program might crash!

-- 
Joe

>> I depend on programs to leave core dump files when they crash.
>
> Debugging a core file has limitations that debugging a live program
> (even if it crashed) does not.  Some of the GDB features do not work
> with core files.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13  5:20       ` Joe Wells
  2007-08-13 19:41         ` Eli Zaretskii
@ 2007-08-14  0:27         ` Richard Stallman
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2007-08-14  0:27 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

    Sorry, I'm not going to run Emacs under GDB indefinitely just on the
    off chance Emacs will crash.

Why not?  I always run Emacs under GDB, and that's on a terminal,
where it causes a slight nuisance when I stop Emacs.  Under X, you could
do it all the time with no inconvenience at all.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13 20:41           ` Joe Wells
@ 2007-08-14  0:28             ` Richard Stallman
  2007-08-14  8:27               ` Kim F. Storm
  2007-08-14  3:07             ` Eli Zaretskii
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2007-08-14  0:28 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs

    I'm not going to run every program on my system under the debugger
    forevermore on the off chance that the program might crash!

Why not?  Do you feel it would be unethical?

Anyway, we're only asking you to do this with Emacs,
not with every program on your system.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-13 20:41           ` Joe Wells
  2007-08-14  0:28             ` Richard Stallman
@ 2007-08-14  3:07             ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2007-08-14  3:07 UTC (permalink / raw)
  To: Joe Wells; +Cc: bug-gnu-emacs, rms

> Cc: rms@gnu.org, bug-gnu-emacs@gnu.org
> From: Joe Wells <jbw@macs.hw.ac.uk>
> Date: Mon, 13 Aug 2007 21:41:42 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Joe Wells <jbw@macs.hw.ac.uk>
> >> Date: Mon, 13 Aug 2007 06:20:53 +0100
> >> Cc: bug-gnu-emacs@gnu.org
> >> 
> >> Sorry, I'm not going to run Emacs under GDB indefinitely just on the
> >> off chance Emacs will crash.
> >
> > Why not?  As long as Emacs doesn't crash, you will not notice any
> > difference in behavior or performance--GDB is simply invisible until
> > there's some event that is noteworthy for the debugger.
> 
> I'm not going to run every program on my system under the debugger
> forevermore on the off chance that the program might crash!

You just reiterated what you said before, but didn't explain why.  Can
you say why you don't like the idea?  I tried to point out that a
debugger will stay out of your way as long as the program runs
normally, so you should not see any ill effects.

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-14  0:28             ` Richard Stallman
@ 2007-08-14  8:27               ` Kim F. Storm
  2007-08-14 19:23                 ` Eli Zaretskii
  2007-08-14 23:26                 ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Kim F. Storm @ 2007-08-14  8:27 UTC (permalink / raw)
  To: rms; +Cc: bug-gnu-emacs, Joe Wells

Richard Stallman <rms@gnu.org> writes:

>     I'm not going to run every program on my system under the debugger
>     forevermore on the off chance that the program might crash!
>
> Why not?  Do you feel it would be unethical?

I mostly run emacs under a debugger - but not every time, as
it is not always practical to do so.

E.g. when emacs is started through a desktop shortcut or launced by
some other program (like through the emacs.bash script distributed
with Emacs), there's no debugger involved ... and sometimes I just
continue working in such an Emacs instance ... without the debugger
in place.

Anyways, I've seen on Windoze that if Emacs crashes, Visual Studio
kicks in and offers you to debug the crashed process.

Can't Emacs be taught to do something similar by hooking various
signal handlers (SIGSEGV, SIGILL, etc) to a function that launches GDB
with command line parameters that attaches it to the (crashed) Emacs
runtime?  That way, GDB is only started _if_ Emacs crashes.

This could be a configuration option `debug-on-crash' with these values:

- nil, meaning don't debug, just dump core and crash
- t, meaning launch gdb unconditionally
- ask, meaining ask user to launch gdb or dump core

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-14  8:27               ` Kim F. Storm
@ 2007-08-14 19:23                 ` Eli Zaretskii
  2007-08-14 23:26                 ` Richard Stallman
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2007-08-14 19:23 UTC (permalink / raw)
  To: Kim F. Storm; +Cc: bug-gnu-emacs, jbw, rms

> From: storm@cua.dk (Kim F. Storm)
> Date: Tue, 14 Aug 2007 10:27:23 +0200
> Cc: bug-gnu-emacs@gnu.org, Joe Wells <jbw@macs.hw.ac.uk>
> 
> I mostly run emacs under a debugger - but not every time, as
> it is not always practical to do so.
> 
> E.g. when emacs is started through a desktop shortcut or launced by
> some other program (like through the emacs.bash script distributed
> with Emacs), there's no debugger involved ... and sometimes I just
> continue working in such an Emacs instance ... without the debugger
> in place.

You can always attach the debugger to a running instance of Emacs.

> Anyways, I've seen on Windoze that if Emacs crashes, Visual Studio
> kicks in and offers you to debug the crashed process.

That's Windows JIT debugging in action.  (Since I use the MinGW
compiled Emacs, Visual Studio is useless for me, so I set up DrMinGW
as the JIT debugger instead.  It's a pity GDB itself doesn't support
the JIT API on Windows, and it's a pity I don't have time to write
it myself.)

> Can't Emacs be taught to do something similar by hooking various
> signal handlers (SIGSEGV, SIGILL, etc) to a function that launches GDB
> with command line parameters that attaches it to the (crashed) Emacs
> runtime?  That way, GDB is only started _if_ Emacs crashes.

It's doable, we did something like this on my daytime job (not for
Emacs).

(Btw, we already catch all fatal signals, so we just need to modify
fatal_error_signal, which handles them all.)

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

* Re: Emacs exited with message “X protocol error: BadPixmap”
  2007-08-14  8:27               ` Kim F. Storm
  2007-08-14 19:23                 ` Eli Zaretskii
@ 2007-08-14 23:26                 ` Richard Stallman
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2007-08-14 23:26 UTC (permalink / raw)
  To: Kim F. Storm; +Cc: bug-gnu-emacs, jbw

    Anyways, I've seen on Windoze that if Emacs crashes, Visual Studio
    kicks in and offers you to debug the crashed process.

    Can't Emacs be taught to do something similar by hooking various
    signal handlers (SIGSEGV, SIGILL, etc) to a function that launches GDB
    with command line parameters that attaches it to the (crashed) Emacs
    runtime?  That way, GDB is only started _if_ Emacs crashes.

I don't know.  I think it is possible to attach with GDB to an existing
process.  But I am not sure whether you can make a process hang around
for inspection if it tries to crash.

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

end of thread, other threads:[~2007-08-14 23:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-12  1:20 Emacs exited with message “X protocol error: BadPixmap” Joe Wells
2007-08-12 17:56 ` Richard Stallman
2007-08-12 18:17   ` Joe Wells
2007-08-13  5:01     ` Richard Stallman
2007-08-13  5:20       ` Joe Wells
2007-08-13 19:41         ` Eli Zaretskii
2007-08-13 20:41           ` Joe Wells
2007-08-14  0:28             ` Richard Stallman
2007-08-14  8:27               ` Kim F. Storm
2007-08-14 19:23                 ` Eli Zaretskii
2007-08-14 23:26                 ` Richard Stallman
2007-08-14  3:07             ` Eli Zaretskii
2007-08-14  0:27         ` Richard Stallman

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