GNU bug report logs - #78920
30.1; Process sentinel is not called when DNS lookup fails

Previous Next

Package: emacs;

Reported by: Shawn Henson <shawn <at> shenso.name>

Date: Sat, 28 Jun 2025 23:27:04 UTC

Severity: normal

Found in version 30.1

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Shawn Henson <shawn <at> shenso.name>, 78920 <at> debbugs.gnu.org
Subject: bug#78920: 30.1; Process sentinel is not called when DNS lookup fails
Date: Mon, 30 Jun 2025 14:46:21 +0200
>>>>> On Mon, 30 Jun 2025 15:20:53 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Shawn Henson <shawn <at> shenso.name>
    >> Cc: Eli Zaretskii <eliz <at> gnu.org>,  78920 <at> debbugs.gnu.org
    >> Date: Sun, 29 Jun 2025 17:22:36 -0400
    >> 
    >> Robert Pluim <rpluim <at> gmail.com> writes:
    >> 
    >> > I wonder what Emacs does for ":nowait t" without async DNS, when the
    >> > connect fails. Iʼd expect it to call the sentinel with a "failed"
    >> > status.
    >> 
    >> Is there a trivial way to test this?

    Eli> Run the recipe on MS-Windows ;-)

    Eli> The result is that we signal an error:

    Eli>   Debugger entered--Lisp error: (error "thisisnotarealhostname/80 No such host is known. ")
    Eli>     make-network-process(:name "dns-fail-test" :buffer "dns-fail-test-buf" :host "thisisnotarealhostname" :service 80 :nowait t :sentinel #f(lambda (process event) [t] (print event)))
    Eli>     (let ((my-test-proc (make-network-process :name "dns-fail-test" :buffer "dns-fail-test-buf" :host "thisisnotarealhostname" :service 80 :nowait t :sentinel #'(lambda (process event) (print event))))) (message "process status: %s" (process-status my-test-proc)))
    Eli>     (progn (let ((my-test-proc (make-network-process :name "dns-fail-test" :buffer "dns-fail-test-buf" :host "thisisnotarealhostname" :service 80 :nowait t :sentinel #'(lambda (process event) (print event))))) (message "process status: %s" (process-status my-test-proc))))
    Eli>     eval((progn (let ((my-test-proc (make-network-process :name "dns-fail-test" :buffer "dns-fail-test-buf" :host "thisisnotarealhostname" :service 80 :nowait t :sentinel #'(lambda ... ...)))) (message "process status: %s" (process-status my-test-proc)))) t)

    Eli> and there's no process shown by list-processes.

Yes, in retrospect that makes sense as a behaviour. But we canʼt do
that with async DNS + :nowait t. Something like the following perhaps?
Although I think the sentinel still gets called when you delete the
leftover process, so probably more is needed.

Robert
-- 

diff --git a/src/process.c b/src/process.c
index e61ec425f7e..473d8294a88 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5172,6 +5172,7 @@ check_for_dns (Lisp_Object proc)
 			concat3 (build_string ("Name lookup of "),
 				 build_string (p->dns_request->ar_name),
 				 build_string (" failed")))));
+      exec_sentinel (proc, build_string ("Name lookup failed\n"));
     }




This bug report was last modified 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.