Subject: bug#58218: 29.0.50; url-retrieve-synchronously with timeout causes process-query-on-exit

From: Eli Zaretskii <[email-masked]>
Date: Sat, 01 Oct 2022 14:44:43 +0300

> Date: Sat, 01 Oct 2022 23:55:05 +1300
> From: Phil Sainty <[email-masked]>
> 
> If you use the TIMEOUT argument to `url-retrieve-synchronously' and the
> response is not obtained within that duration, then the process created
> for that request causes query-on-exit behaviour.  I can reproduce this
> in all the Emacs builds I have, including this 29.0.50 build.
> 
> 
> ;; With a short timeout causing the request to be aborted:
> 
> (url-retrieve-synchronously "http://www.example.com" nil nil 0.01)
> nil
> 
> M-x list-processes
> www.example.com -- open -- -- Main (network connection to 
> www.example.com:80)
> 
> C-x C-c
> Active processes exist; kill them and exit anyway? (yes or no)
> 
> 
> 
> ;; With a long timeout (or a nil timeout):
> 
> (url-retrieve-synchronously "http://www.example.com" nil nil 5)
> #<buffer  *http www.example.com:80*>
> 
> M-x list-processes
> www.example.com -- open -- -- Main (network connection to 
> www.example.com:80)
> 
> C-x C-c
> exits without any process-related prompt
> 
> 
> 
> I'm not sure why the network connection remains open in either case, but
> regardless of that it seems as if process-query-on-exit-flag is set if
> the request times out, and cleared if it does not.  The query-on-exit
> case seems to me like a bug, especially when there is no obvious way to
> obtain the process object and change the flag.

Maybe I'm missing something, but if url-retrieve-synchronously exits
with a timeout, isn't it expected that the process be still alive, and
therefore that Emacs will ask you about killing it?

Or are you saying that when url-retrieve-synchronously exits due to
timeout, it should kill the process?