[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

ra_serf: Reusing the REPORT body bucket when retrying after 401

From: Lieven Govaerts <lgo_at_mobsol.be>
Date: 2007-08-09 23:41:45 CEST

< while I was typing this email jerenkrantz answered my question on IRC.
Justin's answer is included here. >

Situation:
I was trying to solve the DEBUG_DOUBLE_FREE aborts that seem to cause
failure of tens of Subversion regression tests with ra_serf. Apparently,
those aborts seem to be a symptom of larger issue.

What happens is this:
1. svn is preparing a REPORT request (in libsvn_ra_serf/mergeinfo.c).
The body of the request is stored in an aggregate bucket and passed into
the request setup handler.
2. ra_serf starts a loop to drive serf to send requests to the server.
When setting up the request, the body bucket(s) are consumed and the
request is send to the server.
3. the request bucket is (recursively) destroyed
4. when the server requires (Basic) authentication, a 401 response is
received.
5. in ra_serf/util.c handle_response a new request is created, reusing
the original setup request handler and adding the authentication headers.
6. we now start again at step 2.

The only issue now is that the buckets containing the body of the report
request are already consumed, so the 2nd time this request is sent the
body is empty (request line and headers are filled in correctly) so the
server will respond with a 400 Bad Request.

It's at this time that the request bucket is destroyed - again - with
leads to the DEBUG_DOUBLE_FREE abort.

So my question is: is it possible to reuse those body buckets?

Justin's answer:
<jerenkrantz> 'body_delegate' / 'body_delegate_baton'
<jerenkrantz> see commit.c:350
<jerenkrantz> in general, never saw the REPORT needed to be retried
<jerenkrantz> so didn't worry about needing to recreate the body
<jerenkrantz> (only added the body_delegate stuff towards the end; so
not all of the code uses it.)
<jerenkrantz> in short, if the request needs to be retried, serf will
just retry it automatically and call the body_delegate (w/
body_delegate_baton) to create the request body
<jerenkrantz> for update/commit/etc you *may* need to stash the bucket
<jerenkrantz> iow: store/copy report->buckets
<jerenkrantz> as the body is created thru an editor drive
<jerenkrantz> so it's not simple to recreate it programmatically - but
just stash the body somewhere for later consumption - at the cost of a
bit of memory tho

This makes a lot of sense to me, so I'm gonna try it for the mergeinfo
request first.

Lieven

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 9 23:36:39 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.