Branko, Marting,
We use this pattern quite a few times in our own Subversion code (usually using
the specially invented SVN_ERR_CEASE_INVOCATION code to document this pattern),
so there is not really something wrong with this pattern.
The problem is that the our implementation of the serf library in <= 1.8.x
doesn’t handle these errors properly and doesn’t stop the request’s handling
when cancelling. So when you start using the serf ra session again the previous
request continues, and you usually get the same error again and again. (This is
the result of how serf works)
This specific problem is fixed in the ra_serf error handling cleanup that is
targeted towards releasing in 1.9.
Bert
From: Branko Čibej [mailto:[email protected]]
Sent: zondag 26 januari 2014 04:36
To: [email protected]
Subject: Re: Cancelling location segments operation from callback
On 26.01.2014 04:23, Martin Panter wrote:
This is a followup from my message from a couple months ago:
http://svn.haxx.se/users/archive-2013-11/0165.shtml
Basically, I was trying to cancel an svn_ra_get_location_segments()
call by returning an error from the callback. The API call seems to
finish straight away as I expect, but when I subsequently call
svn_ra_get_log2(), it fails in version 1.8.3+, although it succeeds in
1.7.8.
I have converted the demonstration into C code:
https://gist.github.com/vadmium/8613200
When I played with other kinds of URLs, I noticed that “file:” <file:///\\”>
URLs
always work as I expect (no log failure), but that
“svn+ssh://localhost” always returns error 210004 “Malformed network
data”, even in 1.7.8. So this makes me wonder, is Subversion actually
meant to support a callback returning an error to cancel an operation
like I have been doing?
No, callbacks should only return errors if something is wrong. The only correct
way to cancel an operation in Subversion is to set the flag that the
cancellation callback uses.
-- Brane
--
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. [email protected] <mailto:[email protected]>