From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.bugs Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process Date: Sun, 14 Jul 2019 17:30:52 +0530 Message-ID: References: <20190712062057.15599.qmail@localhost.localdomain> <83r26v3cy3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="200215"; mail-complaints-to="usenet@blaine.gmane.org" To: 36648@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 14 15:13:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hmeJT-000pvw-NC for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2019 15:13:11 +0200 Original-Received: from localhost ([::1]:60456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmeJR-0005dt-2Q for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jul 2019 09:13:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59564) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmeJN-0005dl-2a for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 09:13:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmeJL-0001Qd-2N for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 09:13:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hmeJK-0001Q8-AN for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 09:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hmeJK-0002Kt-3K for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 09:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Madhu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jul 2019 13:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36648 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15631099238907 (code B ref -1); Sun, 14 Jul 2019 13:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jul 2019 13:12:03 +0000 Original-Received: from localhost ([127.0.0.1]:43985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmeIM-0002Ja-8e for submit@debbugs.gnu.org; Sun, 14 Jul 2019 09:12:03 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmdYn-00017o-Rr for submit@debbugs.gnu.org; Sun, 14 Jul 2019 08:24:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47117) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmdYl-0005vo-P3 for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 08:24:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmdYj-00009S-QJ for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 08:24:55 -0400 Original-Received: from [117.208.206.155] (port=37548 helo=localhost.localdomain) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hmdYi-0007yn-Mi for bug-gnu-emacs@gnu.org; Sun, 14 Jul 2019 08:24:53 -0400 Original-Received: (qmail 11180 invoked by uid 500); 14 Jul 2019 12:00:52 -0000 In-Reply-To: (Eli Zaretskii's message of "Fri, 12 Jul 2019 10:54:28 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Mailman-Approved-At: Sun, 14 Jul 2019 09:12:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:162978 Archived-At: --=-=-= Content-Type: text/plain [sorry if this is not the correct bug format, I'm replying to a message on gnu.emacs.help] * Eli Zaretskii : Wrote on Fri, 12 Jul 2019 10:54:28 +0300: >> Date: 12 Jul 2019 06:20:57 -0000 >> From: Madhu >> >> Earlier it used to be possible to gdb attach to the emacs process and >> to restart the server. Something like >> Feval(Fcar(Fread_from_string(build_string("(server-start)"),Qnil,Qnil)),Qnil) >> But for some time now that route hits a >> terminate_due_to_signal. (Apparently make-network-process tries to >> signal an error which calls emacs_abort which ends the show) > > Please report a bug with the details of that crash, it may or may not > be a bug. I noticed a couple of different failure modes but this problem seems to be related to pselect. I'm appending one backtrace. Note within the transcript emacs is started with args: -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' After emacs is started by gdb I send it a TSTP to make it enter the debugger. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=f.txt Content-Description: gdb backtrace Reading symbols from emacs-27-athena... SIGINT is used by the debugger. Are you sure you want to change it? (y or n) [answered Y; input not from terminal] DISPLAY = :0 TERM = dumb Breakpoint 1 at 0x41657c: file /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/emacs.c, line 377. Breakpoint 2 at 0x4c4b20: file /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/xterm.c, line 10041. (gdb) set args -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' (gdb) r Starting program: /usr/bin/emacs-27-athena -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". desired fingerprint: 4f725133cab4014b55eba47d01b62b95cf9f5c2332a7167947770875a0da328e found fingerprint: 87155434115e758f6db5abaf07c65b6b14264b02baec22545448e62abb35872f [New Thread 0x7ffff4b5b700 (LWP 10762)] Thread 1 "emacs-27-athena" received signal SIGTSTP, Stopped (user). 0x00007ffff6b47926 in __pselect (nfds=7, readfds=0x7fffffffcf50, writefds=0x7fffffffcfd0, exceptfds=0x0, timeout=, sigmask=) at ../sysdeps/unix/sysv/linux/pselect.c:69 69 result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout, (gdb) p Feval(Fcar(Fread_from_string(build_string("(server-start)"),Qnil,Qnil)),Qnil) Thread 1 "emacs-27-athena" hit Breakpoint 1, terminate_due_to_signal ( sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/emacs.c:377 377 The program being debugged stopped while in a function called from GDB. Evaluation of the expression containing the function (Feval) will be abandoned. When the function is done executing, GDB will silently stop. (gdb) back #0 terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/emacs.c:377 #1 0x0000000000416a50 in emacs_abort () at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/sysdep.c:2437 #2 0x0000000000418a90 in signal_or_quit (error_symbol=XIL(0x58e0), data=XIL(0xdd5663), keyboard_quit=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:1595 #3 0x0000000000418aa9 in Fsignal (error_symbol=, data=data@entry=XIL(0xdd5663)) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:1565 #4 0x0000000000417118 in xsignal (data=XIL(0xdd5663), error_symbol=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:4101 #5 report_file_errno (string=, name=name@entry=XIL(0xdd55f3), errorno=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/fileio.c:222 #6 0x000000000041a663 in connect_network_socket (proc=XIL(0xd7f415), addrinfos=, use_external_socket_p=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/process.c:3633 #7 0x00000000005a2cc6 in Fmake_network_process (nargs=, args=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/process.c:4246 #8 0x000000000055f533 in Ffuncall (nargs=11, args=args@entry=0x7fffffffc298) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:2087 #9 0x0000000000599e60 in exec_byte_code (bytestr=, vector=, maxdepth=, args_template=, nargs=, args=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/bytecode.c:633 #10 0x000000000055f4bf in Ffuncall (nargs=2, args=args@entry=0x7fffffffc688) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:2817 #11 0x0000000000599e60 in exec_byte_code (bytestr=, vector=, maxdepth=, args_template=, nargs=, args=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/bytecode.c:633 #12 0x0000000000560ec1 in apply_lambda (fun=XIL(0xaee9f5), args=, count=count@entry=6) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:2935 #13 0x00000000005611f3 in eval_sub (form=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:2349 #14 0x0000000000562d89 in Feval (form=XIL(0xdd5543), lexical=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:2103 #15 #16 0x00007ffff6b47926 in __pselect (nfds=7, readfds=0x7fffffffcf50, writefds=0x7fffffffcfd0, exceptfds=0x0, timeout=, sigmask=) at ../sysdeps/unix/sysv/linux/pselect.c:69 #17 0x00000000005bead0 in really_call_select (arg=0x7fffffffce80) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/thread.c:586 #18 0x00000000005bf3e7 in thread_select (func=, max_fds=max_fds@entry=7, rfds=rfds@entry=0x7fffffffcf50, wfds=wfds@entry=0x7fffffffcfd0, efds=efds@entry=0x0, timeout=timeout@entry=0x7fffffffd550, sigmask=0x0) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/thread.c:616 #19 0x00000000005dd722 in xg_select (fds_lim=7, rfds=rfds@entry=0x7fffffffd660, wfds=wfds@entry=0x7fffffffd6e0, efds=efds@entry=0x0, timeout=timeout@entry=0x7fffffffd550, sigmask=sigmask@entry=0x0) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/xgselect.c:117 #20 0x00000000005a3fa4 in wait_reading_process_output ( time_limit=time_limit@entry=0, nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, do_display=true, wait_for_cell=wait_for_cell@entry=XIL(0), wait_proc=wait_proc@entry=0x0, just_wait_proc=0) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/process.c:5440 #21 0x00000000004f15c9 in kbd_buffer_get_event (end_time=0x0, used_mouse_menu=0x7fffffffdebb, kbp=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:1058 #22 read_event_from_main_queue (used_mouse_menu=0x7fffffffdebb, local_getcjmp=0x7fffffffdb50, end_time=0x0) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:2138 #23 read_decoded_event_from_main_queue (used_mouse_menu=, prev_event=, local_getcjmp=, end_time=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:2202 #24 read_char (commandflag=1, map=XIL(0xdb7d13), prev_event=XIL(0), used_mouse_menu=0x7fffffffdebb, end_time=0x0) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:2810 #25 0x00000000004f3256 in read_key_sequence (keybuf=, prompt=XIL(0), dont_downcase_last=, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:9125 #26 0x00000000004f4b8e in command_loop_1 () at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:1058 #27 0x000000000055e857 in internal_condition_case ( bfun=bfun@entry=0x4f49b0 , handlers=handlers@entry=XIL(0x50d0), hfun=hfun@entry=0x4ec060 ) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:1352 #28 0x00000000004e703c in command_loop_2 (ignore=ignore@entry=XIL(0)) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:1058 #29 0x000000000055e7b1 in internal_catch (tag=tag@entry=XIL(0xc9f0), func=func@entry=0x4e7020 , arg=arg@entry=XIL(0)) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/eval.c:1113 #30 0x00000000004e6fe4 in command_loop () at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/lisp.h:1058 #31 0x00000000004ebc76 in recursive_edit_1 () at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:714 #32 0x00000000004ebfa0 in Frecursive_edit () at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/keyboard.c:786 #33 0x000000000041c2c3 in main (argc=4, argv=0x7fffffffe338) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/emacs.c:2126 Lisp Backtrace: "make-network-process" (0xffffc2a0) "server-running-p" (0xffffc690) "server-start" (0xffffcbc0) (gdb) up 5 #5 report_file_errno (string=, name=name@entry=XIL(0xdd55f3), errorno=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/fileio.c:222 222 xsignal (Fcar (data), Fcdr (data)); (gdb) pp data (file-missing "make client process failed" "No such file or directory" :name "server-client-test" :family local :server nil :noquery t :service "/dev/shm/madhu/emacs/emacs-test") (gdb) up #6 0x000000000041a663 in connect_network_socket (proc=XIL(0xd7f415), addrinfos=, use_external_socket_p=) at /var/tmp/portage/app-editors/emacs-27.0.50-r3/work/emacs-27.0.50/src/process.c:3633 3633 unbind_to (count, Qnil); (gdb) --=-=-= Content-Type: text/plain Additional notes: - make-network-process signals a (file-missing "make client process failed" "No such file or directory" :name "server-client-test" :family local :server nil :noquery t :service "/dev/shm/madhu/emacs/emacs-test") which is not supposed to happen since the file would be created by the system call to socket. I suspect a wrong error is being reported because of some problem with pselect (which is interrupted when we enter gdb) - load custom.el to try to avoid an unrelated emacs-abort which otherwise seems to happen from within the custom mechanism - another unrelated emacs-bug. M-x gud-gdb -- emacs .. with the above arg line fails to pass the quoted arguments to gdb. --=-=-=--