GNU bug report logs - #18116
24.3.92; url-http calls CALLBACK recursively with malformed CBARGS if the former calls `delete-process'

Previous Next

Package: emacs;

Reported by: Dmitry <dgutov <at> yandex.ru>

Date: Sun, 27 Jul 2014 03:14:02 UTC

Severity: minor

Found in version 24.3.92

Fixed in version 24.3.93.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

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: Dmitry <dgutov <at> yandex.ru>
Subject: bug#18116: closed (Re: bug#18116: 24.3.92; url-http calls
 CALLBACK recursively with malformed CBARGS if the former calls
 `delete-process')
Date: Fri, 19 Sep 2014 02:01:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#18116: 24.3.92; url-http calls CALLBACK recursively with malformed CBARGS if the former calls `delete-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 18116 <at> debbugs.gnu.org.

-- 
18116: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18116
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18116-done <at> debbugs.gnu.org
Subject: Re: bug#18116: 24.3.92; url-http calls CALLBACK recursively with
 malformed CBARGS if the former calls `delete-process'
Date: Fri, 19 Sep 2014 06:00:07 +0400
Version: 24.3.93.4

On 09/12/2014 09:22 PM, Stefan Monnier wrote:

> I think there is indeed a change of behavior in that the sentinel used
> to be nil'd while running it.
> [ This was changed because it prevented the sentinel from modifying itself.  ]

Okay, I guess.

>> To me, "When retrieval is completed, execute the function CALLBACK, using
>> the arguments listed in CBARGS." means that it will be called exactly with
>> the value of CBARGS passed to `url-http', whereas instead the list gets
>> prepended with stuff before it's passed to CALLBACK.
>
> Can you improve those docstrings, to avoid such confusion in the future?

Done, I think (r117511). Although maybe we should remove the middle 
paragraph in `url-http' docstring and replace it with a reference to 
`url-retrieve-internal': its second sentence has very much the same 
contents, only using different words.

[Message part 3 (message/rfc822, inline)]
From: Dmitry <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92;
 url-http calls CALLBACK recursively with malformed CBARGS if the
 former calls `delete-process'
Date: Sun, 27 Jul 2014 06:12:57 +0300
Note: this could be considered a regression from Emacs 24.3

With this test case:

```
(require 'url-http)

(defvar uht-counter 0)

(defun uht-callback (status)
  (declare (special url-http-process))
  (message "%s %s" uht-counter status)
  (delete-process url-http-process))

(defun uht-test ()
  (setq uht-counter (1+ uht-counter))
  ;; The port must not be open.
  (url-http (url-generic-parse-url "http://localhost:3333") #'uht-callback (list 'foo)))
```

Evaluate `(uht-test)' and see two messages in the message log with the
same counter value. The second message outputs a different STATUS value,
caused by modification of `url-callback-arguments' in
`url-http-async-sentinel', like this:

4 (:error (error connection-failed failed with code 111
 :host localhost :service 3333) . foo)
4 (:error (error connection-failed deleted
 :host localhost :service 3333) :error (error connection-failed failed with code 111
 :host localhost :service 3333) . foo)

If the callback expects STATUS to contain some specific data structure,
that can cause breakage, see https://github.com/marijnh/tern/issues/350
for an example.

Now, I'm not entirely sure the problem is in `url-http'. It does not
manifest in Emacs 24.3, possibly because in the current pretest, when
the connection fails, the `url-http-process' is still alive when
`delete-process' is called in `uht-callback'. This is not the case in
the current stable Emacs (wherein, as a consequence, `uht-callback'
doesn't get called the second time), so this could be a regression in
the processes subsystem.


In GNU Emacs 24.3.92.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-07-24 on axl
Repository revision: 117398 stephen.berman <at> gmx.net-20140722213204-51v7bp0chfei6wbx
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04.1 LTS



This bug report was last modified 10 years and 327 days ago.

Previous Next


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