New experiment (still using vanilla GNU Emacs 24.5.1 with Lucid in GDB) appears to show that the problem is the scroll bar. Long story short, if I set `scroll-bar-mode` to `nil` in my emacs config, I can happily create and destroy emacsclient all day long without upsetting the daemon. See below for the details: gdb ./emacs (gdb) run -Q -nw -f server-start In another terminal: emacsclient -c -n `-n` makes the terminal return as soon as emacsclient is launched, so we have to manually close and relaunch. After 5-10 tries it will hang, but now the stacktrace we get is slightly different: ----- #0 0x00007ffff5fb8b68 in widen (narrow=1988, wide=) at ../../src/xcb_io.c:224 #1 poll_for_event (dpy=dpy@entry=0x105f2f0) at ../../src/xcb_io.c:264 #2 0x00007ffff5fb8cfc in poll_for_response (dpy=dpy@entry=0x105f2f0) at ../../src/xcb_io.c:289 #3 0x00007ffff5fb9147 in _XReadEvents (dpy=dpy@entry=0x105f2f0) at ../../src/xcb_io.c:424 #4 0x00007ffff5fa1751 in XIfEvent (dpy=0x105f2f0, event=event@entry=0x7fffffff1a80, predicate=predicate@entry=0x7ffff5fe7790 <_CheckCMEvent>, arg=arg@entry=0xd85d30 "\200\365*\366\377\177") at ../../src/IfEvent.c:68 #5 0x00007ffff5fe7f24 in _XimXRead (im=0xd85d30, recv_buf=0x7fffffff2460 "", buf_len=2048, ret_len=0x7fffffff1bac) at ../../../../modules/im/ximcp/imTrX.c:476 #6 0x00007ffff5fe8b80 in _XimReadData (im=im@entry=0xd85d30, len=len@entry=0x7fffffff1c0e, buf=buf@entry=0x7fffffff2460 "", buf_size=buf_size@entry=2048) at ../../../../modules/im/ximcp/imTransR.c:165 #7 0x00007ffff5fe8e71 in _XimRead (im=im@entry=0xd85d30, len=len@entry=0x7fffffff1c5e, buf=buf@entry=0x7fffffff2460 "", buf_size=buf_size@entry=2048, predicate=predicate@entry=0x7ffff5fd6c80 <_XimDestroyICCheck>, arg=arg@entry=0xf6a360 " \365*\366\377\177") at ../../../../modules/im/ximcp/imTransR.c:235 #8 0x00007ffff5fd70e8 in _XimProtoDestroyIC (xic=0xf6a360) at ../../../../modules/im/ximcp/imDefIc.c:914 #9 0x00007ffff5fc58d2 in XDestroyIC (ic=0xf6a360) at ../../../src/xlibi18n/ICWrap.c:265 #10 0x000000000054c6d6 in free_frame_xic (f=0x134b118) at xfns.c:2087 #11 0x00000000005455c5 in x_free_frame_resources (f=0x134b118) at xterm.c:9275 #12 0x0000000000545c11 in x_destroy_window (f=0x134b118) at xterm.c:9383 #13 0x000000000042826b in delete_frame (frame=..., force=...) at frame.c:1387 #14 0x0000000000541ff3 in x_connection_closed (dpy=0x105f2f0, error_message=0x7fffffff2fd0 "X protocol error: BadPixmap (invalid Pixmap parameter) on protocol request 55") at xterm.c:7635 #15 0x00000000005422b7 in x_error_quitter (display=0x105f2f0, event=0x7fffffff3180) at xterm.c:7747 #16 0x0000000000542209 in x_error_handler (display=0x105f2f0, event=0x7fffffff3180) at xterm.c:7717 #17 0x00007ffff5fbb54b in _XError (dpy=dpy@entry=0x105f2f0, rep=rep@entry=0xf83650) at ../../src/XlibInt.c:1463 #18 0x00007ffff5fb85e7 in handle_error (dpy=0x105f2f0, err=0xf83650, in_XReply=) at ../../src/xcb_io.c:213 #19 0x00007ffff5fb8695 in handle_response (dpy=dpy@entry=0x105f2f0, response=0xf83650, in_XReply=in_XReply@entry=1) at ../../src/xcb_io.c:325 #20 0x00007ffff5fb9578 in _XReply (dpy=dpy@entry=0x105f2f0, rep=rep@entry=0x7fffffff3340, extra=extra@entry=0, discard=discard@entry=0) at ../../src/xcb_io.c:627 #21 0x00007ffff5faf4cf in XQueryColor (dpy=0x105f2f0, cmap=32, def=0x7fffffff33a0) at ../../src/QuColor.c:49 #22 0x00007ffff6b8c50c in Xaw3dComputeTopShadowRGB () from /usr/lib/x86_64-linux-gnu/libXaw3d.so.6 #23 0x00007ffff6b8c600 in ?? () from /usr/lib/x86_64-linux-gnu/libXaw3d.so.6 #24 0x00007ffff6b8ca6a in ?? () from /usr/lib/x86_64-linux-gnu/libXaw3d.so.6 #25 0x00007ffff66f1afc in CallInitialize (class=0x7ffff6dae960 , req_widget=req_widget@entry=0x7fffffff35b0, new_widget=new_widget@entry=0x1614b40, args=args@entry=0x7fffffff3a80, num_args=3) at ../../src/Create.c:226 #26 0x00007ffff66f1ac6 in CallInitialize (class=0x7ffff6dac1c0 , req_widget=req_widget@entry=0x7fffffff35b0, new_widget=new_widget@entry=0x1614b40, args=args@entry=0x7fffffff3a80, num_args=num_args@entry=3) at ../../src/Create.c:221 #27 0x00007ffff66f2427 in xtCreate (name=name@entry=0x703028 "verticalScrollBar", class=class@entry=0x0, widget_class=widget_class@entry=0x7ffff6dac1c0 , parent=parent@entry=0x16166f0, default_screen=0x15105b0, args=args@entry=0x7fffffff3a80, num_args=num_args@entry=3, typed_args=typed_args@entry=0x0, num_typed_args=num_typed_args@entry=0, parent_constraint_class=0x0, post_proc=post_proc@entry=0x7ffff66f1b40 ) at ../../src/Create.c:416 #28 0x00007ffff66f2840 in _XtCreateWidget (name=name@entry=0x703028 "verticalScrollBar", widget_class=widget_class@entry=0x7ffff6dac1c0 , parent=parent@entry=0x16166f0, args=args@entry=0x7fffffff3a80, num_args=num_args@entry=3, typed_args=typed_args@entry=0x0, num_typed_args=num_typed_args@entry=0) at ../../src/Create.c:570 #29 0x00007ffff66f2b0e in XtCreateWidget (name=0x703028 "verticalScrollBar", widget_class=0x7ffff6dac1c0 , parent=0x16166f0, args=0x7fffffff3a80, num_args=3) at ../../src/Create.c:589 #30 0x000000000053c417 in x_create_toolkit_scroll_bar (f=0x134b118, bar=0x1338328) at xterm.c:4768 #31 0x000000000053c937 in x_scroll_bar_create (w=0x134c2e0, top=686, left=1, width=16, height=19) at xterm.c:4960 #32 0x000000000053d167 in XTset_vertical_scroll_bar (w=0x134c2e0, portion=0, whole=0, position=0) at xterm.c:5205 #33 0x000000000046b064 in set_vertical_scroll_bar (w=0x134c2e0) at xdisp.c:15905 #34 0x000000000046fcfa in redisplay_window (window=..., just_this_one_p=false) at xdisp.c:16947 #35 0x00000000004644f2 in redisplay_window_0 (window=...) at xdisp.c:14373 #36 0x00000000006173df in internal_condition_case_1 (bfun=0x4644b0 , arg=..., handlers=..., hfun=0x46447f ) at eval.c:1372 #37 0x000000000046445d in redisplay_windows (window=...) at xdisp.c:14353 #38 0x0000000000463204 in redisplay_internal () at xdisp.c:13949 #39 0x0000000000463db4 in redisplay_preserve_echo_area (from_where=13) at xdisp.c:14206 #40 0x000000000066b46d in Fdelete_process (process=...) at process.c:877 #41 0x000000000061ac4a in Ffuncall (nargs=2, args=0x7fffffff6880) at eval.c:2811 #42 0x0000000000666389 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=1, args=0x7fffffff7010) at bytecode.c:916 #43 0x000000000061b47a in funcall_lambda (fun=..., nargs=1, arg_vector=0x7fffffff7008) at eval.c:2978 #44 0x000000000061ae25 in Ffuncall (nargs=2, args=0x7fffffff7000) at eval.c:2860 #45 0x0000000000666389 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffff7748) at bytecode.c:916 #46 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffff7748) at eval.c:2978 #47 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffff7740) at eval.c:2860 #48 0x0000000000619438 in eval_sub (form=...) at eval.c:2154 #49 0x000000000061710f in internal_lisp_condition_case (var=..., bodyform=..., handlers=...) at eval.c:1317 #50 0x0000000000667498 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffff8128) at bytecode.c:1162 #51 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffff8128) at eval.c:2978 #52 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffff8120) at eval.c:2860 #53 0x0000000000619438 in eval_sub (form=...) at eval.c:2154 #54 0x000000000061710f in internal_lisp_condition_case (var=..., bodyform=..., handlers=...) at eval.c:1317 #55 0x0000000000667498 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=7, args=0x7fffffff8b68) at bytecode.c:1162 #56 0x000000000061b47a in funcall_lambda (fun=..., nargs=7, arg_vector=0x7fffffff8b30) at eval.c:2978 #57 0x000000000061ae25 in Ffuncall (nargs=8, args=0x7fffffff8b28) at eval.c:2860 #58 0x0000000000666389 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffff9290) at bytecode.c:916 #59 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffff9290) at eval.c:2978 #60 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffff9288) at eval.c:2860 #61 0x0000000000666389 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffff99b8) at bytecode.c:916 #62 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffff99b8) at eval.c:2978 #63 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffff99b0) at eval.c:2860 #64 0x0000000000619438 in eval_sub (form=...) at eval.c:2154 #65 0x000000000061710f in internal_lisp_condition_case (var=..., bodyform=..., handlers=...) at eval.c:1317 #66 0x0000000000667498 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=1, args=0x7fffffffa3f8) at bytecode.c:1162 #67 0x000000000061b47a in funcall_lambda (fun=..., nargs=1, arg_vector=0x7fffffffa3f0) at eval.c:2978 #68 0x000000000061ae25 in Ffuncall (nargs=2, args=0x7fffffffa3e8) at eval.c:2860 #69 0x0000000000666389 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffffab98) at bytecode.c:916 #70 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffffab98) at eval.c:2978 #71 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffffab90) at eval.c:2860 #72 0x0000000000619438 in eval_sub (form=...) at eval.c:2154 #73 0x000000000061710f in internal_lisp_condition_case (var=..., bodyform=..., handlers=...) at eval.c:1317 #74 0x0000000000667498 in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=0, args=0x7fffffffb558) at bytecode.c:1162 #75 0x000000000061b47a in funcall_lambda (fun=..., nargs=0, arg_vector=0x7fffffffb558) at eval.c:2978 #76 0x000000000061ae25 in Ffuncall (nargs=1, args=0x7fffffffb550) at eval.c:2860 #77 0x0000000000619438 in eval_sub (form=...) at eval.c:2154 #78 0x00000000006166f1 in internal_catch (tag=..., func=0x618e0c , arg=...) at eval.c:1112 #79 0x00000000006670dc in exec_byte_code (bytestr=..., vector=..., maxdepth=..., args_template=..., nargs=2, args=0x7fffffffbe88) at bytecode.c:1097 #80 0x000000000061b47a in funcall_lambda (fun=..., nargs=2, arg_vector=0x7fffffffbe78) at eval.c:2978 #81 0x000000000061ae25 in Ffuncall (nargs=3, args=0x7fffffffbe70) at eval.c:2860 #82 0x0000000000619ed8 in Fapply (nargs=2, args=0x7fffffffbf60) at eval.c:2350 #83 0x000000000061a508 in apply1 (fn=..., arg=...) at eval.c:2584 #84 0x0000000000674852 in read_process_output_call (fun_and_args=...) at process.c:4967 #85 0x00000000006173df in internal_condition_case_1 (bfun=0x6747c8 , arg=..., handlers=..., hfun=0x674854 ) at eval.c:1372 #86 0x0000000000674efd in read_and_dispose_of_process_output (p=0x1348370, chars=0x7fffffffc080 "-env XDG_VTNR=7 -env XDG_SESSION_ID=c2 -env XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/rlange -env SELINUX_INIT=YES -env CLUTTER_IM_MODULE=xim -env SESSION=ubuntu -env GPG_AGENT_INFO=/run/user/1000/ke"..., nbytes=3947, coding=0xf5a810) at process.c:5180 #87 0x0000000000674bd9 in read_process_output (proc=..., channel=3947) at process.c:5089 #88 0x0000000000674106 in wait_reading_process_output (time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=..., wait_proc=0x0, just_wait_proc=0) at process.c:4811 #89 0x0000000000422d0c in sit_for (timeout=..., reading=true, display_option=1) at dispnew.c:5867 #90 0x0000000000576bff in read_char (commandflag=1, map=..., prev_event=..., used_mouse_menu=0x7fffffffd7f5, end_time=0x0) at keyboard.c:2810 #91 0x00000000005858f4 in read_key_sequence (keybuf=0x7fffffffda20, bufsize=30, prompt=..., dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9089 #92 0x0000000000573161 in command_loop_1 () at keyboard.c:1453 #93 0x000000000061726e in internal_condition_case (bfun=0x572d8a , handlers=..., hfun=0x57253d ) at eval.c:1348 #94 0x0000000000572a28 in command_loop_2 (ignore=...) at keyboard.c:1178 #95 0x00000000006166f1 in internal_catch (tag=..., func=0x572a05 , arg=...) at eval.c:1112 #96 0x00000000005729dc in command_loop () at keyboard.c:1157 #97 0x0000000000572069 in recursive_edit_1 () at keyboard.c:778 #98 0x0000000000572239 in Frecursive_edit () at keyboard.c:849 #99 0x000000000057017b in main (argc=5, argv=0x7fffffffdde8) at emacs.c:1642 Lisp Backtrace: "redisplay_internal (C function)" (0xd553f0) "delete-process" (0xffff6888) "server-delete-client" (0xffff7008) 0x13524d8 PVEC_COMPILED "funcall" (0xffff7740) 0x13544f8 PVEC_COMPILED "funcall" (0xffff8120) "server-execute" (0xffff8b30) 0x1341258 PVEC_COMPILED 0x134b470 PVEC_COMPILED "funcall" (0xffff99b0) "server-execute-continuation" (0xffffa3f0) 0x134a3f0 PVEC_COMPILED "funcall" (0xffffab90) 0x13492e0 PVEC_COMPILED "funcall" (0xffffb550) "server-process-filter" (0xffffbe78) -----