unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
@ 2013-12-09 15:58 Nix
  2013-12-09 17:57 ` Dmitry Antipov
  0 siblings, 1 reply; 11+ messages in thread
From: Nix @ 2013-12-09 15:58 UTC (permalink / raw)
  To: 16093


Start emacs --daemon (using the lucid toolkit), under X. Shut X down.
Emacs crashes shortly afterwards.


The lack of symbol table info is concerning (obviously my gdb has
forgotten how to look up separated debug info *yet again*), but I don't
think that important, since the death site is after a (garbage-collect)
thus not in Lisp-land anyway. Obviously no xbacktrace is possible: the
process is dead.

It is fairly clear that we should not be calling xftfont_close() if the
X server is not there! Why has this started happening?

#0  0x00007f3b87dfc82b in raise () from /lib/libpthread.so.0
No symbol table info available.
#1  0x00000000004d8208 in terminate_due_to_signal ()
No symbol table info available.
#2  0x00000000004f1583 in emacs_abort ()
No symbol table info available.
#3  0x000000000054b970 in Fsignal ()
No symbol table info available.
#4  0x000000000054b989 in xsignal ()
No symbol table info available.
#5  0x000000000054c0f7 in xsignal1 ()
No symbol table info available.
#6  0x000000000047ad25 in Fcheck_coding_system ()
No symbol table info available.
#7  0x000000000048e540 in code_convert_string ()
No symbol table info available.
#8  0x0000000000508612 in Fexpand_file_name ()
No symbol table info available.
#9  0x0000000000507ec8 in Fexpand_file_name ()
No symbol table info available.
#10 0x000000000050cf3b in Fdo_auto_save ()
No symbol table info available.
#11 0x00000000004d802b in shut_down_emacs ()
No symbol table info available.
#12 0x00000000004d81d9 in terminate_due_to_signal ()
No symbol table info available.
#13 0x00000000004f08c8 in deliver_fatal_thread_signal ()
No symbol table info available.
#14 <signal handler called>
No symbol table info available.
#15 xcb_generate_id (c=0x0) at xcb_xid.c:44
        ret = <optimized out>
        __PRETTY_FUNCTION__ = "xcb_generate_id"
#16 0x00007f3b8b7a207f in _XAllocIDs (dpy=0x7dfd530, ids=<optimized out>, count=<optimized out>) at xcb_io.c:545
        i = <optimized out>
#17 0x00007f3b8b7a20ee in _XIDHandler (dpy=<optimized out>) at xcb_io.c:522
No locals.
#18 0x00007f3b8b7a4ca7 in _XPrivSyncFunction (dpy=0x7dfd530) at XlibInt.c:252
No locals.
#19 0x00007f3b8b7819c4 in XCreatePixmap (dpy=dpy@entry=0x7dfd530, d=712, width=width@entry=1, height=height@entry=1, depth=depth@entry=24) at CrPixmap.c:58
        pid = 98771741
        req = <optimized out>
#20 0x00007f3b8b55ccd9 in XRenderHasDepths (dpy=0x7dfd530) at Xrender.c:161
        p = <optimized out>
        dc = {next = 0x0, dpy = 0x7dfd530, missing = 0, serial = 18809308}
        dp = <optimized out>
        previousHandler = 0x4b4e20 <x_error_handler>
        depths = <optimized out>
        missing = <optimized out>
        scr = <optimized out>
        d = <optimized out>
        s = <optimized out>
#21 XRenderExtAddDisplay (dpy=0x7dfd530, extinfo=<optimized out>, ext_name=<optimized out>) at Xrender.c:202
        dpyinfo = 0x89c9120
        ext_name = 0x7f3b8b75f160 <XRenderExtensionName> "RENDER"
        extinfo = 0x7f3b8b75f280 <XRenderExtensionInfo>
#22 XRenderFindDisplay (dpy=0x7dfd530) at Xrender.c:289
No locals.
#23 XRenderFindDisplay (dpy=dpy@entry=0x7dfd530) at Xrender.c:283
        dpyinfo = 0x1
#24 0x00007f3b8b558f0e in XRenderFreeGlyphSet (dpy=0x7dfd530, glyphset=98566201) at Glyph.c:71
        info = <optimized out>
        req = <optimized out>
#25 0x00007f3b8b34bf70 in XftFontDestroy (dpy=0x7dfd530, public=0x8641460) at xftfreetype.c:1046
        info = <optimized out>
        font = 0x8641460
        i = <optimized out>
#26 0x00000000005ab133 in xftfont_close ()
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#27 0x0000000000533b08 in Fgarbage_collect ()
No symbol table info available.
#28 0x000000000054aca2 in Ffuncall ()
No symbol table info available.
#29 0x000000000057ed93 in exec_byte_code ()
No symbol table info available.
#30 0x000000000054a306 in eval_sub ()
No symbol table info available.
#31 0x000000000054d119 in internal_lisp_condition_case ()
No symbol table info available.
#32 0x000000000057ff97 in exec_byte_code ()
No symbol table info available.
#33 0x000000000054a961 in funcall_lambda ()
No symbol table info available.
#34 0x000000000054accb in Ffuncall ()
No symbol table info available.
#35 0x000000000057ed93 in exec_byte_code ()
No symbol table info available.
#36 0x000000000054a961 in funcall_lambda ()
No symbol table info available.
#37 0x000000000054accb in Ffuncall ()
No symbol table info available.
#38 0x000000000054bd9b in Fapply ()
No symbol table info available.
#39 0x000000000054ad99 in Ffuncall ()
No symbol table info available.
#40 0x000000000057ed93 in exec_byte_code ()
No symbol table info available.
#41 0x000000000054a306 in eval_sub ()
No symbol table info available.
#42 0x000000000054d119 in internal_lisp_condition_case ()
No symbol table info available.
#43 0x000000000057ff97 in exec_byte_code ()
No symbol table info available.
#44 0x000000000054a961 in funcall_lambda ()
No symbol table info available.
#45 0x000000000054accb in Ffuncall ()
No symbol table info available.
#46 0x000000000054b0aa in call1 ()
No symbol table info available.
#47 0x00000000004dda26 in timer_check ()
No symbol table info available.
#48 0x00000000004ddde9 in readable_events ()
No symbol table info available.
#49 0x00000000004df2e8 in get_input_pending ()
No symbol table info available.
#50 0x00000000004e24dc in detect_input_pending_run_timers ()
No symbol table info available.
#51 0x0000000000587099 in wait_reading_process_output ()
No symbol table info available.
#52 0x00000000004df873 in read_decoded_event_from_main_queue ()
No symbol table info available.
#53 0x00000000004e368d in read_char ()
No symbol table info available.
#54 0x00000000004e4c24 in read_key_sequence.constprop.38 ()
No symbol table info available.
#55 0x00000000004e5f81 in command_loop_1 ()
No symbol table info available.
#56 0x0000000000549275 in internal_condition_case ()
No symbol table info available.
#57 0x00000000004daa5e in command_loop_2 ()
No symbol table info available.
#58 0x000000000054917b in internal_catch ()
No symbol table info available.
#59 0x00000000004dcb47 in recursive_edit_1 ()
No symbol table info available.
#60 0x00000000004dce42 in Frecursive_edit ()
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#61 0x00000000004134e5 in main ()
No symbol table info available.


In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2013-11-25 on spindle
Bzr revision: 115223 rgm@gnu.org-20131125032513-euhdejyqc4g7u4i2
Windowing system distributor `The X.Org Foundation', version 11.0.11402902
System LSB Version:	:core-4.1-amd64:core-4.1-noarch

Configured using:
 `configure --without-pop --without-kerberos --without-hesiod
 --without-mmdf --with-x-toolkit=lucid --with-wide-int
 --with-file-notification=inotify NO_FAST_MATH=t
 'CFLAGS=-Wstrict-overflow=1 -g -gdwarf-4 -feliminate-dwarf2-dups
 -feliminate-unused-debug-types -fvar-tracking-assignments -O2
 -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_LARGEFILE64_SOURCE'
 'CPPFLAGS=-D__NO_STRING_INLINES -D__NO_MATH_INLINES
 -D_LARGEFILE64_SOURCE' 'LDFLAGS=-Wl,--enable-new-dtags
 -Wl,--hash-style=gnu -Wl,-O1 -Wl,-z,relro ''

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Summary

Minor modes in effect:
  gnus-mailing-list-mode: t
  icicle-mode: t
  minibuffer-depth-indicate-mode: t
  savehist-mode: t
  show-paren-mode: t
  global-semantic-mru-bookmark-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-decoration-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-local-symbol-highlight-mode: t
  global-semantic-idle-summary-mode: t
  global-srecode-minor-mode: t
  global-ede-mode: t
  global-auto-complete-mode: t
  global-cwarn-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-mode: t
  compile-bookmarks-mode: t
  global-git-gutter-mode: t
  icomplete-mode: t
  Info-breadcrumbs-in-mode-line-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  recentf-mode: t
  mv-shell-mode: t
  timeclock-mode-line-display: t
  shell-dirtrack-mode: t
  which-function-mode: t
  winner-mode: t
  desktop-save-mode: t
  display-time-mode: t
  image-diredx-async-mode: t
  tooltip-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t

Recent input:
SPC m y SPC t o d o SPC l i s t SPC i s SPC l i k e 
. <down> <right> <up> C-c C-c <switch-frame> <help-echo> 
<help-echo> <switch-frame> <switch-frame> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> C-x 
5 b * G r <tab> <return> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <prior> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <down> C-s e m a c s 
<left> <down> <down> <down> M-g M-g <up> <up> <return> 
<return> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> C-d <down> 
C-x M-b <right> <right> <right> <right> <right> <right> 
<right> <right> <down> <return> <return> <switch-frame> 
<down> # # # # <down> <down> <down> <down> <down> <down> 
<right> <up> <up> <up> <right> <right> <right> <right> 
<right> <right> <right> <right> <down> # <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <up> 
<right> # B m U n r e l a t e d / B u <tab> <return> 
<switch-frame> C-s d a e m o n C-s <right> <return> 
n <up> <return> <down-mouse-1> <mouse-movement> <mouse-1> 
<next> <next> <prior> <next> <next> <next> <next> <next> 
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> <next> <prior> <prior> <prior> <prior> <prior> 
<prior> <prior> <prior> <prior> <prior> <prior> <prior> 
<prior> <prior> <prior> <prior> <next> <switch-frame> 
<switch-frame> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> h <right> 
<right> C-s C-s C-s C-s C-s <right> <right> <right> 
q <right> <right> <right> <right> <right> <right> <right> 
C-x M-b <right> C-x b * S u <tab> m <tab> e <tab> <backspace> 
<return> <left> <left> <up> M S-SPC M-x r e p o r t 
- e m a c - b u f <backspace> <backspace> <backspace> 
<backspace> s - b u g <return>

Recent messages:
Deleting article 33653 in emacs-bugs
Deleting article 33654 in emacs-bugs
Deleting article 33655 in emacs-bugs
Deleting article 33656 in emacs-bugs
Deleting article 33657 in emacs-bugs
Deleting article 33658 in emacs-bugs
Expiring articles...done
Auto-saving...done
Matching buffer contents...
Computing completion candidates... [2 times]

Load-path shadows:
/usr/share/emacs/site-lisp/.el-get/package/elpa/vline-20120108.1245/vline hides /usr/share/emacs/site-lisp/.el-get/vline/vline
/usr/share/emacs/site-lisp/.el-get/full-ack/.dir-locals hides /usr/share/emacs/site-lisp/.el-get/el-get/.dir-locals
/home/nix/lisp/defaults hides /usr/share/emacs/site-lisp/defaults
/home/nix/lisp/emacs/site-wide/site-start hides /usr/share/emacs/site-lisp/site-start
/home/nix/lisp/emacs/site-wide/default hides /usr/share/emacs/site-lisp/default
/home/nix/lisp/emacs/site-wide/scroll-in-place hides /usr/share/emacs/site-lisp/scroll-in-place
/usr/share/emacs/site-lisp/el-get/recipes/emacswiki/ange-ftp hides /usr/share/emacs/24.3.50/lisp/net/ange-ftp
/usr/share/emacs/site-lisp/.el-get/full-ack/.dir-locals hides /usr/share/emacs/24.3.50/lisp/gnus/.dir-locals
/usr/share/emacs/site-lisp/emms/tq hides /usr/share/emacs/24.3.50/lisp/emacs-lisp/tq

Features:
(shadow emacsbug face-remap nndoc misearch multi-isearch mailalias nnir
qp gnus-picon gnus-cite shr-color color shr browse-url gnus-async
gnus-bcklg gnus-salt gnus-dup gnus-ml gnus-topic mm-archive url-http
url-gw url-cache url-auth url-handlers nndraft nnrss xml gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg utf-7 gnutls nnimap
parse-time utf7 nnmh nnfolder gnus-cache bbdb-gnus bbdb-snarf epa-file
epa derived epg netrc gnus-demon nntp dot-gnus-mail gnus-registry
registry dot-gnus-splits nnmairix nnml mm-url smtpmail gnus-art mm-uu
mml2015 epg-config mm-view mml-smime smime dig dot-gnus-articles
dot-gnus-sa background gnus-sum nnoo gnus-group gnus-undo nnmail
mail-source dot-gnus-bbdb dot-gnus-colourization tc mail-extr gnus-start
gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader server
semantic/texi tex-info texinfo semantic/imenu semantic/sb
semantic/tag-file semantic/db-file data-debug cedet-files
semantic/bovine/c semantic/decorate/include hideif semantic/bovine/c-by
semantic/lex-spp semantic/bovine/gcc semantic/dep semantic/bovine
semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn
cc-langs generic ede/emacs vc-git checkdoc eldoc elisp-slime-nav etags
ede/dired jka-compr compilation-recenter-end-autoloads
compile-bookmarks-autoloads fold-dwim-autoloads fringe-helper-autoloads
image+-autoloads image-dired+-autoloads iresize-autoloads
inflections-autoloads mv-shell-autoloads vline-autoloads
yasnippet-bundle-autoloads site-default two-column icicles icicles-mode
bookmark+ bookmark+-key crosshairs col-highlight vline hl-line+ hl-line
bookmark+-1 bookmark+-bmu bookmark+-lit bookmark dired+ dired-x
dired-aux mb-depth+ mb-depth icicles-cmd2 icicles-cmd1 icicles-mcmd
doremi icicles-fn icicles-var apropos-fn+var icicles-opt fuzzy-match
el-swank-fuzzy levenshtein fuzzy cus-theme hexrgb icicles-face dot-emacs
dot-emacs-emacs savehist xemacs-compat add-log misc init-music
network-stream starttls tls emms-volume emms-volume-amixer emms-history
emms-bookmarks emms-metaplaylist-mode emms-browser sort
emms-playlist-sort emms-last-played emms-playing-time emms-stream-info
emms-streams emms-mode-line emms-cache emms-info later-do
emms-playlist-limit emms-playlist-mode emms-player-mpd tq
emms-player-simple emms-source-playlist emms-source-file emms
emms-compat init-message-modes ede/cpp-root bbdb-expire bbdb-hooks
bbdb-com silly-mail sendmail message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev mail-utils gmm-utils mailheader init-time-tracking
timeclock-visualize sgml-mode url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
auto-edit-substitute init-prog-modes init-prog-modes-emacs filecache
diminish paren inversion semantic/db-global semantic/symref/global
semantic/symref semantic/db-find semantic/db-ref cedet-global
semantic/mru-bookmark semantic/db-mode semantic/db
semantic/decorate/mode semantic/idle srecode/mode semantic/senator
semantic/format semantic/ctxt semantic/wisent semantic/wisent/wisent
semantic/decorate pulse srecode/insert srecode/filters srecode/args
srecode/find srecode/map srecode/ctxt semantic/tag-ls semantic/find
srecode/compile srecode/dictionary srecode/table ede/speedbar ede/files
ede ede/base ede/auto ede/source eieio-base eieio-speedbar speedbar
sb-image ezimage dframe eieio-custom auto-complete-config auto-complete
popup yasnippet-bundle dropdown-list yasnippet assoc cwarn srecode
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet htmlfontify cus-edit cus-start cus-load
compile-bookmarks compile git-gutter-fringe fringe-helper git-gutter
gtags gpicker ffap url-parse url-vars font-latex latex edmacro kmacro
tex-style tex cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs miniedit wide-n icomplete+ icomplete
menu-bar+ apropos+ apropos help-fns+ help+ frame-fns avoid easy-mmode
info+ thingatpt+ thingatpt mouse3 naked undo-tree diff site-start-load
gawd-keys finder finder-inf find-func gawd-keys-emacs gawd-navigation
ace-jump-mode gawd-mode-frobs gawd-mode-frobs-emacs windmove tramp-cache
tramp-sh recentf tree-widget wid-edit mv-shell printing ps-print ps-def
lpr uptimes bbdb timezone timeclock term disp-table ehelp electric tramp
tramp-compat auth-source eieio eieio-core gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color
hideshow filladapt gawd-faces gawd-faces-emacs nix-dark-theme gawd-misc
gawd-misc-emacs which-func imenu winner time-date gawd-lists
bbdb-autoloads magit-autoloads desktop frameset generic-x uniquify time
scroll-in-place site-start-emacs site-autoloads .loaddefs image-dired+
byte-opt image-dired format-spec advice warnings el-get cl-macs gv
el-get-autoloads el-get-list-packages el-get-notify help-mode
el-get-dependencies el-get-build el-get-status pp el-get-recipes
el-get-byte-compile el-get-methods el-get-fossil el-get-svn
el-get-pacman el-get-github-zip el-get-github-tar el-get-http-zip
el-get-http-tar el-get-hg el-get-git-svn el-get-fink el-get-emacswiki
el-get-http el-get-emacsmirror el-get-github el-get-git el-get-elpa
el-get-darcs el-get-cvs el-get-bzr el-get-brew el-get-builtin
el-get-apt-get el-get-custom el-get-core autoload help-fns lisp-mnt
bytecomp byte-compile cconv cl cl-loaddefs cl-lib dired info
auctex-autoloads tex-site package emms-auto w3m-load ring filesets
easymenu flash-paren saveplace tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind inotify
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty emacs)

-- 
NULL && (void)





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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-09 15:58 bug#16093: 24.3.50; Crash of emacs --daemon on killing X server Nix
@ 2013-12-09 17:57 ` Dmitry Antipov
  2013-12-10 19:43   ` Jan Djärv
  2013-12-10 23:39   ` Nix
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry Antipov @ 2013-12-09 17:57 UTC (permalink / raw)
  To: 16093

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On 12/09/2013 07:58 PM, Nix wrote:
>
> Start emacs --daemon (using the lucid toolkit), under X. Shut X down.
> Emacs crashes shortly afterwards.
>
>
> The lack of symbol table info is concerning (obviously my gdb has
> forgotten how to look up separated debug info *yet again*), but I don't
> think that important, since the death site is after a (garbage-collect)
> thus not in Lisp-land anyway. Obviously no xbacktrace is possible: the
> process is dead.
>
> It is fairly clear that we should not be calling xftfont_close() if the
> X server is not there! Why has this started happening?

Hm... IIUC there is no convenient way to check whether X display connection
is alive. But we can do some tricks, for example, try to select() or poll()
ConnectionNumber() - if there is no EBADF, X server is hopefully present...

Dmitry



[-- Attachment #2: bug16093.patch --]
[-- Type: text/x-patch, Size: 1859 bytes --]

=== modified file 'src/xfns.c'
--- src/xfns.c	2013-12-03 17:22:05 +0000
+++ src/xfns.c	2013-12-09 17:50:35 +0000
@@ -136,6 +136,20 @@
 
 static struct x_display_info *x_display_info_for_name (Lisp_Object);
 
+bool
+x_display_valid (Display *d)
+{
+  fd_set fdset;
+  struct timespec timeout;
+  int fd = ConnectionNumber (d); 
+
+  FD_ZERO (&fdset);
+  FD_SET (fd, &fdset);
+  timeout.tv_sec = 0;
+  timeout.tv_nsec = 1000;
+  return pselect (fd + 1, &fdset, NULL, NULL, &timeout, NULL) != -1;
+}
+
 /* Let the user specify an X display with a Lisp object.
    OBJECT may be nil, a frame or a terminal object.
    nil stands for the selected frame--or, if that is not an X frame,

=== modified file 'src/xfont.c'
--- src/xfont.c	2013-11-04 06:09:03 +0000
+++ src/xfont.c	2013-12-09 17:47:41 +0000
@@ -897,7 +897,8 @@
   if (xfi->xfont)
     {
       block_input ();
-      XFreeFont (xfi->display, xfi->xfont);
+      if (x_display_valid (xfi->display))
+	XFreeFont (xfi->display, xfi->xfont);
       unblock_input ();
       xfi->xfont = NULL;
     }

=== modified file 'src/xftfont.c'
--- src/xftfont.c	2013-10-27 05:30:34 +0000
+++ src/xftfont.c	2013-12-09 17:48:47 +0000
@@ -495,7 +495,8 @@
     {
       block_input ();
       XftUnlockFace (xftfont_info->xftfont);
-      XftFontClose (xftfont_info->display, xftfont_info->xftfont);
+      if (x_display_valid (xftfont_info->display))
+	XftFontClose (xftfont_info->display, xftfont_info->xftfont);
       unblock_input ();
       xftfont_info->xftfont = NULL;
     }

=== modified file 'src/xterm.h'
--- src/xterm.h	2013-12-07 23:04:10 +0000
+++ src/xterm.h	2013-12-09 17:46:16 +0000
@@ -989,6 +989,7 @@
 /* Defined in xfns.c */
 
 extern Lisp_Object x_get_focus_frame (struct frame *);
+extern bool x_display_valid (Display *);
 
 #ifdef USE_GTK
 extern int xg_set_icon (struct frame *, Lisp_Object);


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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-09 17:57 ` Dmitry Antipov
@ 2013-12-10 19:43   ` Jan Djärv
  2013-12-10 23:39   ` Nix
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Djärv @ 2013-12-10 19:43 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 16093

Hello.

9 dec 2013 kl. 18:57 skrev Dmitry Antipov <dmantipov@yandex.ru>:

> On 12/09/2013 07:58 PM, Nix wrote:
>> 
>> Start emacs --daemon (using the lucid toolkit), under X. Shut X down.
>> Emacs crashes shortly afterwards.
>> 
>> 
>> The lack of symbol table info is concerning (obviously my gdb has
>> forgotten how to look up separated debug info *yet again*), but I don't
>> think that important, since the death site is after a (garbage-collect)
>> thus not in Lisp-land anyway. Obviously no xbacktrace is possible: the
>> process is dead.
>> 
>> It is fairly clear that we should not be calling xftfont_close() if the
>> X server is not there! Why has this started happening?
> 
> Hm... IIUC there is no convenient way to check whether X display connection
> is alive. But we can do some tricks, for example, try to select() or poll()
> ConnectionNumber() - if there is no EBADF, X server is hopefully present...


Well, file descriptors are reused, so it may be used for something else and give a false positive.
To do this properly we would need some kind of cleanup function that is called when the display goes away.

	Jan D.






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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-09 17:57 ` Dmitry Antipov
  2013-12-10 19:43   ` Jan Djärv
@ 2013-12-10 23:39   ` Nix
  2013-12-11  0:20     ` Glenn Morris
  2013-12-11  6:01     ` Jan Djärv
  1 sibling, 2 replies; 11+ messages in thread
From: Nix @ 2013-12-10 23:39 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 16093

On 9 Dec 2013, Dmitry Antipov stated:

> On 12/09/2013 07:58 PM, Nix wrote:
>> It is fairly clear that we should not be calling xftfont_close() if the
>> X server is not there! Why has this started happening?
>
> Hm... IIUC there is no convenient way to check whether X display connection
> is alive. But we can do some tricks, for example, try to select() or poll()
> ConnectionNumber() - if there is no EBADF, X server is hopefully present...

Well, it's never happened before. Something has clearly changed... maybe
we're just cleaning up fonts much more lazily than before? (An ugly hack
to "fix" it in that case might just be to trigger a garbage-collect when
the last frame on a given terminal goes away.)

The Xlib error handler should really be being called, which suggests
this is a bug in Xft as well: I'll chase that up. (But that can't be the
cause of this: I last updated my Xft a year and a half ago.)

-- 
NULL && (void)





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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-10 23:39   ` Nix
@ 2013-12-11  0:20     ` Glenn Morris
  2013-12-11  4:28       ` Dmitry Antipov
  2013-12-11  6:01     ` Jan Djärv
  1 sibling, 1 reply; 11+ messages in thread
From: Glenn Morris @ 2013-12-11  0:20 UTC (permalink / raw)
  To: Nix; +Cc: 16093, Dmitry Antipov

Nix wrote:

> Well, it's never happened before. Something has clearly changed...

Time to bisect, then!





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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-11  0:20     ` Glenn Morris
@ 2013-12-11  4:28       ` Dmitry Antipov
  2013-12-13 22:35         ` Nix
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Antipov @ 2013-12-11  4:28 UTC (permalink / raw)
  To: Glenn Morris, Nix; +Cc: 16093

On 12/11/2013 04:20 AM, Glenn Morris wrote:

> Time to bisect, then!

Don't. This is r114797.






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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-10 23:39   ` Nix
  2013-12-11  0:20     ` Glenn Morris
@ 2013-12-11  6:01     ` Jan Djärv
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Djärv @ 2013-12-11  6:01 UTC (permalink / raw)
  To: Nix; +Cc: 16093, Dmitry Antipov

Hello.

11 dec 2013 kl. 00:39 skrev Nix <nix@esperi.org.uk>:

> On 9 Dec 2013, Dmitry Antipov stated:
> 
>> On 12/09/2013 07:58 PM, Nix wrote:
>>> It is fairly clear that we should not be calling xftfont_close() if the
>>> X server is not there! Why has this started happening?
>> 
>> Hm... IIUC there is no convenient way to check whether X display connection
>> is alive. But we can do some tricks, for example, try to select() or poll()
>> ConnectionNumber() - if there is no EBADF, X server is hopefully present...
> 
> Well, it's never happened before. Something has clearly changed... maybe
> we're just cleaning up fonts much more lazily than before? (An ugly hack
> to "fix" it in that case might just be to trigger a garbage-collect when
> the last frame on a given terminal goes away.)
> 
> The Xlib error handler should really be being called, which suggests
> this is a bug in Xft as well: I'll chase that up. (But that can't be the
> cause of this: I last updated my Xft a year and a half ago.)

If the display connection is gone, no error handler is called.  It is normal.
The change is that font objects that are garbage collected runs the fonmt specific cleanup, which is at a random time, in this case after the display went away.

	Jan D.







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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-11  4:28       ` Dmitry Antipov
@ 2013-12-13 22:35         ` Nix
  2013-12-14  2:08           ` Dmitry Antipov
  0 siblings, 1 reply; 11+ messages in thread
From: Nix @ 2013-12-13 22:35 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 16093

On 11 Dec 2013, Dmitry Antipov told this:

>
> On 12/11/2013 04:20 AM, Glenn Morris wrote:
>
>> Time to bisect, then!
>
> Don't. This is r114797.

Oh yes, that's a smoking gun all right.

I concur that *not* freeing fonts at some point is a gigantic leak,
though. Am I right to assume that bug 16128 is the same bug, and that
this is thus fixed by r115505? Or does r115506 indicate that you've been
forced to let this leak stand? :(

-- 
NULL && (void)





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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-13 22:35         ` Nix
@ 2013-12-14  2:08           ` Dmitry Antipov
  2013-12-16  7:52             ` Dmitry Antipov
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Antipov @ 2013-12-14  2:08 UTC (permalink / raw)
  To: Nix; +Cc: 16093

On 12/14/2013 02:35 AM, Nix wrote:

> I concur that *not* freeing fonts at some point is a gigantic leak,
> though.

It's really gigantic in a specially designed case, which is quite
far from the most of regular use cases.  But it's a leak anyway.

> Am I right to assume that bug 16128 is the same bug, and that
> this is thus fixed by r115505? Or does r115506 indicate that you've
> been forced to let this leak stand? :(

No.  Revision 115489 (reverted by 115506) was an attempt to solve
two minor issues: 1) 'n_fonts' counter in FRAME_DISPLAY_INFO (f)
should be updated when the font is closed and 2) when font-entity
is gone, font_driver->free_entity should be called for it, if
non-NULL (for now macfont.m is the only driver where it is so).

Dmitry






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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-14  2:08           ` Dmitry Antipov
@ 2013-12-16  7:52             ` Dmitry Antipov
  2014-01-06 13:32               ` Nix
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Antipov @ 2013-12-16  7:52 UTC (permalink / raw)
  To: Nix; +Cc: 16093

Please try to upgrade to trunk >= r115541 (now there is a check
whether 'Display *' pointer in font objects is still in use).

Dmitry






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

* bug#16093: 24.3.50; Crash of emacs --daemon on killing X server
  2013-12-16  7:52             ` Dmitry Antipov
@ 2014-01-06 13:32               ` Nix
  0 siblings, 0 replies; 11+ messages in thread
From: Nix @ 2014-01-06 13:32 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: 16093

On 16 Dec 2013, Dmitry Antipov spake thusly:

> Please try to upgrade to trunk >= r115541 (now there is a check
> whether 'Display *' pointer in font objects is still in use).

A bit late, I know (Christmas got in the way), but this has indeed fixed
it.

-- 
NULL && (void)





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

end of thread, other threads:[~2014-01-06 13:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-09 15:58 bug#16093: 24.3.50; Crash of emacs --daemon on killing X server Nix
2013-12-09 17:57 ` Dmitry Antipov
2013-12-10 19:43   ` Jan Djärv
2013-12-10 23:39   ` Nix
2013-12-11  0:20     ` Glenn Morris
2013-12-11  4:28       ` Dmitry Antipov
2013-12-13 22:35         ` Nix
2013-12-14  2:08           ` Dmitry Antipov
2013-12-16  7:52             ` Dmitry Antipov
2014-01-06 13:32               ` Nix
2013-12-11  6:01     ` Jan Djärv

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