From unknown Sat Sep 20 14:55:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process 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-GNU-PR-Keywords: To: 36648@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15631099238907 (code B ref -1); Sun, 14 Jul 2019 13:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2019 13:12:03 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: **** X-Spam-Status: No, score=4.9 required=5.0 tests=BAYES_50, RCVD_IN_PBL, RDNS_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 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 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 Received: (qmail 11180 invoked by uid 500); 14 Jul 2019 12:00:52 -0000 From: Madhu In-Reply-To: (Eli Zaretskii's message of "Fri, 12 Jul 2019 10:54:28 +0300") References: <20190712062057.15599.qmail@localhost.localdomain> <83r26v3cy3.fsf@gnu.org> Date: Sun, 14 Jul 2019 17:30:52 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 117.208.206.155 X-Spam-Score: -1.3 (-) 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= 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. --=-=-=-- From unknown Sat Sep 20 14:55:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jul 2019 05:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Madhu Cc: 36648@debbugs.gnu.org Received: via spool by 36648-submit@debbugs.gnu.org id=B36648.156342812121132 (code B ref 36648); Thu, 18 Jul 2019 05:36:02 +0000 Received: (at 36648) by debbugs.gnu.org; 18 Jul 2019 05:35:21 +0000 Received: from localhost ([127.0.0.1]:53276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnz4a-0005Ul-Qw for submit@debbugs.gnu.org; Thu, 18 Jul 2019 01:35:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnz4Z-0005UZ-2w for 36648@debbugs.gnu.org; Thu, 18 Jul 2019 01:35:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hnz4T-0001kB-KY; Thu, 18 Jul 2019 01:35:13 -0400 Received: from [176.228.60.248] (port=1889 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hnz4S-0003Gk-OA; Thu, 18 Jul 2019 01:35:13 -0400 Date: Thu, 18 Jul 2019 08:35:04 +0300 Message-Id: <8336j3zz07.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Madhu on Sun, 14 Jul 2019 17:30:52 +0530) References: <20190712062057.15599.qmail@localhost.localdomain> <83r26v3cy3.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Madhu > Date: Sun, 14 Jul 2019 17:30:52 +0530 > > >> 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. The data you collected shows that your attempt to restart the server signals an error: > #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 See the call to report_file_errno in frame #5? Signaling an error while waiting for input is fatal in Emacs, so it aborts. > 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") So here's the reason for the problem: the way you try to restart the server fails because the socket no longer exists. > 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) I don't think the error is wrong. Look at the function server-running-p: it attempts to determine whether the server is already running by creating a client process of the server. This happens _before_ restarting the server. IOW, Emacs attempts to clean up if the server is already running. In your case, the socket doesn't exist, so this method of restarting the server can no longer be used safely, because when you attach GDB to Emacs, Emacs will almost always be waiting for input, where every error is fatal. Instead, I suggest to restart the server by binding a function to the sigusr1 or sigusr2 event. These events can be triggered by the corresponding signals. > - another unrelated emacs-bug. M-x gud-gdb -- emacs .. with the above > arg line fails to pass the quoted arguments to gdb. Sorry, I don't think I understand what exactly do you mean by "with the above arg line". Can you please show a full sequence of commands that produce this problem? Thanks. From unknown Sat Sep 20 14:55:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process Resent-From: Madhu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jul 2019 15:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eliz@gnu.org Cc: 36648@debbugs.gnu.org Received: via spool by 36648-submit@debbugs.gnu.org id=B36648.156346224620227 (code B ref 36648); Thu, 18 Jul 2019 15:05:03 +0000 Received: (at 36648) by debbugs.gnu.org; 18 Jul 2019 15:04:06 +0000 Received: from localhost ([127.0.0.1]:54506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ho7wz-0005GA-GS for submit@debbugs.gnu.org; Thu, 18 Jul 2019 11:04:06 -0400 Received: from smtp6.ctinetworks.com ([205.166.61.199]:53054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ho7rt-0002xH-AO for 36648@debbugs.gnu.org; Thu, 18 Jul 2019 10:58:50 -0400 Received: from localhost (unknown [117.193.12.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: enometh@meer.net) by smtp6.ctinetworks.com (Postfix) with ESMTPSA id 005F683B8C; Thu, 18 Jul 2019 10:58:44 -0400 (EDT) Date: Thu, 18 Jul 2019 20:28:21 +0530 (IST) Message-Id: <20190718.202821.1196946470014157934.enometh@meer.net> From: Madhu In-Reply-To: <8336j3zz07.fsf@gnu.org> References: <8336j3zz07.fsf@gnu.org> X-Mailer: Mew version 6.8 on Emacs 27.0 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Thu_Jul_18_20_28_21_2019_951)--" Content-Transfer-Encoding: 7bit X-ctinetworks-Information: Please contact the ISP for more information X-ctinetworks-MailScanner-ID: 005F683B8C.A87B5 X-ctinetworks-VirusCheck: Found to be clean X-ctinetworks-SpamCheck: X-ctinetworks-Watermark: 1564325928.33599@sbG5+Kvfg0s0B7Ak2i9Kkw X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Thu, 18 Jul 2019 11:04:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) ----Next_Part(Thu_Jul_18_20_28_21_2019_951)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit * Eli Zaretskii <8336j3zz07.fsf@gnu.org> Wrote on Thu, 18 Jul 2019 08:35:04 +0300 >> From: Madhu >> Date: Sun, 14 Jul 2019 17:30:52 +0530 >> >> #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 > > See the call to report_file_errno in frame #5? Signaling an error > while waiting for input is fatal in Emacs, so it aborts. > >> 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") > > So here's the reason for the problem: the way you try to restart the > server fails because the socket no longer exists. > >> 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) > > I don't think the error is wrong. Look at the function > server-running-p: it attempts to determine whether the server is > already running by creating a client process of the server. This > happens _before_ restarting the server. IOW, Emacs attempts to clean > up if the server is already running. In your case, the socket > doesn't exist, so this method of restarting the server can no longer > be used safely, because when you attach GDB to Emacs, Emacs will > almost always be waiting for input, where every error is fatal. server-running-p tries to start a server, and if it fails with a file error, then the condition-case is expected to catch it and the function is supposed to return nil. If I modify this function (see patch [1]) to test for the file instead of trying to catch an error from make-network-process, then this particular example (of restarting the server from gdb) works. >From the point of view of elisp, no error should be signalled - it should be caught by the condition-case. If I'm running an emacs compiled without X, when I suspend emacs and enter gdb on the same terminal, then no error is signalled (presumably because emacs is not waiting for input). > Instead, I suggest to restart the server by binding a function to the > sigusr1 or sigusr2 event. These events can be triggered by the > corresponding signals. Thank you, I will take up this suggestion. The default SIGUSR is very useful to unwedge emacs. However there seems to be room for improvement around the "abort when awaiting for input behaviour" - as there are other situations within gdb which are not "really" error situations which unnecessarily abort emacs. >> - another unrelated emacs-bug. M-x gud-gdb -- emacs .. with the above >> arg line fails to pass the quoted arguments to gdb. > > Sorry, I don't think I understand what exactly do you mean by "with > the above arg line". Can you please show a full sequence of commands > that produce this problem? M-x gud-gdb RET gdb --args emacs --arg -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' RET => |Reading symbols from emacs... (gdb) show args Argument list to give program being debugged when it is started is "--arg -Q --eval \'\(progn \(load-library custom \) \(load-library server \) \(setq server-name emacs-test \)\)\'". (gdb) i.e. the arguments are not correctly quoted when passed to gdb. [1] ----Next_Part(Thu_Jul_18_20_28_21_2019_951)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="avoid-condition-case-in-server-running-p.patch" diff --git a/lisp/server.el b/lisp/server.el index 436a44a7e9..2bd512f52c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -763,6 +763,9 @@ server-running-p Emacs process. To check from a Lisp program whether a server was started by the current Emacs process, use the `server-process' variable." (unless name (setq name server-name)) + (if (and (not server-use-tcp) + (not (file-exists-p (expand-file-name name server-socket-dir)))) + nil (condition-case nil (if server-use-tcp (with-temp-buffer @@ -778,7 +781,7 @@ server-running-p :name "server-client-test" :family 'local :server nil :noquery t :service (expand-file-name name server-socket-dir))) t) - (file-error nil))) + (file-error nil)))) ;;;###autoload (define-minor-mode server-mode ----Next_Part(Thu_Jul_18_20_28_21_2019_951)---- From unknown Sat Sep 20 14:55:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jul 2019 15:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Madhu Cc: 36648@debbugs.gnu.org Received: via spool by 36648-submit@debbugs.gnu.org id=B36648.156346351522346 (code B ref 36648); Thu, 18 Jul 2019 15:26:01 +0000 Received: (at 36648) by debbugs.gnu.org; 18 Jul 2019 15:25:15 +0000 Received: from localhost ([127.0.0.1]:54535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ho8HS-0005oK-PK for submit@debbugs.gnu.org; Thu, 18 Jul 2019 11:25:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ho8HQ-0005o5-Cs for 36648@debbugs.gnu.org; Thu, 18 Jul 2019 11:25:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ho8HK-0002jP-Vu; Thu, 18 Jul 2019 11:25:07 -0400 Received: from [176.228.60.248] (port=3009 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ho8HF-0007rD-GE; Thu, 18 Jul 2019 11:25:02 -0400 Date: Thu, 18 Jul 2019 18:24:54 +0300 Message-Id: <838ssvwek9.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <20190718.202821.1196946470014157934.enometh@meer.net> (message from Madhu on Thu, 18 Jul 2019 20:28:21 +0530 (IST)) References: <8336j3zz07.fsf@gnu.org> <20190718.202821.1196946470014157934.enometh@meer.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 18 Jul 2019 20:28:21 +0530 (IST) > Cc: 36648@debbugs.gnu.org > From: Madhu > > >From the point of view of elisp, no error should be signalled - it > should be caught by the condition-case. You called those functions directly, from outside of the Lisp machine, so the condition-case machinery is not working. > However there seems to be room for improvement around the "abort when > awaiting for input behaviour" - as there are other situations within > gdb which are not "really" error situations which unnecessarily abort > emacs. There are inherent difficulties that require this behavior, sorry. > M-x gud-gdb RET > gdb --args emacs --arg -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' RET > > => > > |Reading symbols from emacs... > (gdb) show args > Argument list to give program being debugged when it is started is "--arg -Q --eval \'\(progn \(load-library custom \) \(load-library server \) \(setq server-name emacs-test \)\)\'". I suggest to use "M-x gdb", not "M-x gud-gdb". The latter is an old and semi-deprecated way of running GDB from Emacs. I guess we can close this bug report? From unknown Sat Sep 20 14:55:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process Resent-From: Madhu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jul 2019 01:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eliz@gnu.org Cc: 36648@debbugs.gnu.org Received: via spool by 36648-submit@debbugs.gnu.org id=B36648.15635012337056 (code B ref 36648); Fri, 19 Jul 2019 01:54:01 +0000 Received: (at 36648) by debbugs.gnu.org; 19 Jul 2019 01:53:53 +0000 Received: from localhost ([127.0.0.1]:54933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoI5o-0001pk-KX for submit@debbugs.gnu.org; Thu, 18 Jul 2019 21:53:52 -0400 Received: from smtp6.ctinetworks.com ([205.166.61.199]:41232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoI5m-0001pb-7W for 36648@debbugs.gnu.org; Thu, 18 Jul 2019 21:53:50 -0400 Received: from localhost (unknown [117.193.17.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: enometh@meer.net) by smtp6.ctinetworks.com (Postfix) with ESMTPSA id 9B3E983EA3; Thu, 18 Jul 2019 21:53:43 -0400 (EDT) Date: Fri, 19 Jul 2019 07:23:39 +0530 (IST) Message-Id: <20190719.072339.546175785955923287.enometh@meer.net> From: Madhu In-Reply-To: <838ssvwek9.fsf@gnu.org> References: <8336j3zz07.fsf@gnu.org> <20190718.202821.1196946470014157934.enometh@meer.net> <838ssvwek9.fsf@gnu.org> X-Mailer: Mew version 6.8 on Emacs 27.0 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ctinetworks-Information: Please contact the ISP for more information X-ctinetworks-MailScanner-ID: 9B3E983EA3.A5462 X-ctinetworks-VirusCheck: Found to be clean X-ctinetworks-SpamCheck: X-ctinetworks-Watermark: 1564365229.21324@8SePyyTiLjUTtTSzXd5mgw X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * Eli Zaretskii <838ssvwek9.fsf@gnu.org> Wrote on Thu, 18 Jul 2019 18:24:54 +0300 >> Date: Thu, 18 Jul 2019 20:28:21 +0530 (IST) >> Cc: 36648@debbugs.gnu.org >> From: Madhu >> >> >From the point of view of elisp, no error should be signalled - it >> >should be caught by the condition-case. > > You called those functions directly, from outside of the Lisp machine, > so the condition-case machinery is not working. The Lisp Language specifies how conditions are to be handled. The Lisp machine can only be a virtual machine on which that lisp code runs. If the behaviour of a piece of lisp code (however it is invoked) isn't according to the lisp specification, it is a bug in the implementation. The behaviour here can be deemed to be a bug in the implementation of condition-case rather than a design-bug in condition-case. >> However there seems to be room for improvement around the "abort when >> awaiting for input behaviour" - as there are other situations within >> gdb which are not "really" error situations which unnecessarily abort >> emacs. > > There are inherent difficulties that require this behavior, sorry. I'm sure there is some way to mitigate it, though I probably will not be able to find it. >> M-x gud-gdb RET >> gdb --args emacs --arg -Q --eval '(progn (load-library "custom") (load-library "server") (setq server-name "emacs-test"))' RET >> >> => >> >> |Reading symbols from emacs... >> (gdb) show args >> Argument list to give program being debugged when it is started is "--arg -Q --eval \'\(progn \(load-library custom \) \(load-library server \) \(setq server-name emacs-test \)\)\'". > > I suggest to use "M-x gdb", not "M-x gud-gdb". The latter is an old > and semi-deprecated way of running GDB from Emacs. [Unfortunately for me gud-gdb is the only way I can use gdb under emacs. I was using M-x gdb in emacs19, but was unable to use gdb under emacs for some time when it was replaced by gdb-mi - where it seemed a superhuman adversary would rearrange my windows and impede my workflow in myraid ways - until I discovered gud-gdb] > I guess we can close this bug report? Yes please. From unknown Sat Sep 20 14:55:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Madhu Subject: bug#36648: closed (Re: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process) Message-ID: References: <83v9vyv7kl.fsf@gnu.org> X-Gnu-PR-Message: they-closed 36648 X-Gnu-PR-Package: emacs Reply-To: 36648@debbugs.gnu.org Date: Fri, 19 Jul 2019 06:54:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1563519242-2786-1" This is a multi-part message in MIME format... ------------=_1563519242-2786-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #36648: emacs signals under gdb - [Re: connecting to a lost server process which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 36648@debbugs.gnu.org. --=20 36648: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36648 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1563519242-2786-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 36648-done) by debbugs.gnu.org; 19 Jul 2019 06:53:45 +0000 Received: from localhost ([127.0.0.1]:55017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoMm0-0000iT-Pn for submit@debbugs.gnu.org; Fri, 19 Jul 2019 02:53:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoMlz-0000iH-GL for 36648-done@debbugs.gnu.org; Fri, 19 Jul 2019 02:53:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hoMls-0004ij-JF; Fri, 19 Jul 2019 02:53:38 -0400 Received: from [176.228.60.248] (port=3824 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hoMlr-0008JJ-CZ; Fri, 19 Jul 2019 02:53:36 -0400 Date: Fri, 19 Jul 2019 09:53:30 +0300 Message-Id: <83v9vyv7kl.fsf@gnu.org> From: Eli Zaretskii To: Madhu In-reply-to: <20190719.072339.546175785955923287.enometh@meer.net> (message from Madhu on Fri, 19 Jul 2019 07:23:39 +0530 (IST)) Subject: Re: bug#36648: emacs signals under gdb - [Re: connecting to a lost server process References: <8336j3zz07.fsf@gnu.org> <20190718.202821.1196946470014157934.enometh@meer.net> <838ssvwek9.fsf@gnu.org> <20190719.072339.546175785955923287.enometh@meer.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36648-done Cc: 36648-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 19 Jul 2019 07:23:39 +0530 (IST) > Cc: 36648@debbugs.gnu.org > From: Madhu > > > I suggest to use "M-x gdb", not "M-x gud-gdb". The latter is an old > > and semi-deprecated way of running GDB from Emacs. > > [Unfortunately for me gud-gdb is the only way I can use gdb under > emacs. I was using M-x gdb in emacs19, but was unable to use gdb under > emacs for some time when it was replaced by gdb-mi - where it seemed a > superhuman adversary would rearrange my windows and impede my workflow > in myraid ways - until I discovered gud-gdb] My suggestion is still to use "M-x gdb", but do that in a separate frame. Then the dedicated windows used by gdb-mi.el will not get in the way of your other windows. > > I guess we can close this bug report? > > Yes please. Thanks, done. ------------=_1563519242-2786-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jul 2019 13:12:03 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: **** X-Spam-Status: No, score=4.9 required=5.0 tests=BAYES_50, RCVD_IN_PBL, RDNS_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 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 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 Received: (qmail 11180 invoked by uid 500); 14 Jul 2019 12:00:52 -0000 From: Madhu To: bug-gnu-emacs@gnu.org Subject: emacs signals under gdb - [Re: connecting to a lost server process In-Reply-To: (Eli Zaretskii's message of "Fri, 12 Jul 2019 10:54:28 +0300") References: <20190712062057.15599.qmail@localhost.localdomain> <83r26v3cy3.fsf@gnu.org> Date: Sun, 14 Jul 2019 17:30:52 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 117.208.206.155 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= 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. --=-=-=-- ------------=_1563519242-2786-1--