GNU bug report logs - #20159
24.4; url-retrieve invokes same callback twice with kill-buffer

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Sat, 21 Mar 2015 20:47:01 UTC

Severity: normal

Tags: confirmed

Found in version 24.4

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#20159: closed (24.4; url-retrieve invokes same callback twice
 with kill-buffer)
Date: Tue, 01 Mar 2016 04:10:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 01 Mar 2016 15:08:18 +1100
with message-id <87wppmx2kt.fsf <at> gnus.org>
and subject line Re: bug#20159: 24.4; url-retrieve invokes same callback twice with kill-buffer
has caused the debbugs.gnu.org bug report #20159,
regarding 24.4; url-retrieve invokes same callback twice with kill-buffer
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
20159: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20159
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Christopher Wellons <wellons <at> nullprogram.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; url-retrieve invokes same callback twice with kill-buffer
Date: Sat, 21 Mar 2015 16:46:16 -0400
Emacs 24.4.1 on x86_64 Linux, the callback passed to `url-retrieve' is
invoked twice if `kill-buffer' is called within the callback when the
status reports a connection failure. In the example below, it's assumed
this URL will reject the connection, which will cause `url-retrieve' to
asynchronously invoke the callback with an error status ("failed with
code 111\n"). The second invocation of the callback is synchronous with
the first invocation, because it's called recursively from within the
`kill-buffer' call. The error message the second time is "deleted\n".

    ;;; -*- lexical-binding: t; -*-
    (let ((calls 0))
      (url-retrieve "http://localhost:1/"
                    (lambda (_)
                      (assert (= 1 (cl-incf calls)))
                      (kill-buffer))))

When I eval the above expression, the assertion fails asynchronously.

    error in process sentinel: Assertion failed: (= 1 (cl-incf calls))

I expect the callback given to `url-retrieve' to never be invoked more
than once each time it's passed to `url-retrieve'. Ideally I expect it
to be called exactly once for each call to `url-retrieve', always
delivering errors asynchronously.

I also tested this on a Windows build of Emacs. The callback is invoked
zero times because the connection error is delivered synchronously at
the call to `url-retrieve' (which I now realize explains why connection
queuing doesn't work right on Windows). So even if the double-invoke
problem is fixed for Linux, the behavior still differs across platforms.


[Message part 3 (message/rfc822, inline)]
From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Christopher Wellons <wellons <at> nullprogram.com>
Cc: 20159-done <at> debbugs.gnu.org
Subject: Re: bug#20159: 24.4;
 url-retrieve invokes same callback twice with kill-buffer
Date: Tue, 01 Mar 2016 15:08:18 +1100
The two statuses are these:

Process status failed
Process status closed

But I kinda think that url.el is behaving as specified.  The callbacks
may be called many times, and you're supposed to check the status.  And
if you're killing the same buffer twice, this is pilot error.

So I don't think there's really a bug here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



This bug report was last modified 9 years and 81 days ago.

Previous Next


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