Comment 71 for bug 1449212

Revision history for this message
Samuel Merritt (torgomatic) wrote :

I like the infocache thing. Really, the part I like about it is the part where the proxy doesn't mutate the passed-in environment, but takes a copy and mangles *that* instead.

Any time we have a middleware that makes more than one request (DLO, SLO, bulk, versions, symlinks...), we end up with these crappy bugs where the middleware makes a request using some environment, the proxy or a later middleware scribbles all over it, and then our middleware reuses that environment and things blow up. That's what happened here, right?

A) tempurl put swift.authorize in the environment and called the rest of the chain

B) the proxy called swift.authorize and then mutated the environment to remove it, which is okay because nobody else is ever going to re-use this environment for anything ever again /s

C) dlo saw the response was for a manifest and so it made a new environment based on the current environment to go fetch segments

D) the proxy got another request without swift.authorize in it (since the proxy wiped it out in step B) and let the request proceed

E) lots of people spent time typing up 70+ comments on this Launchpad bug

We can either work around this bit of request mutation to fix this specific bug and leave a land mine for ourselves to step on next time, or we can get rid of it now. I'd rather get rid of it now.

Moving all that cache into swift.infocache also makes it easier to eliminate future request-environment mutations as we find them. It lets you make a shallow copy of the environment to mutate, thus saving your caller from you, while still ensuring we don't get the same info from memcache or account/container servers twice. It's taking all that hazardous mutable stuff and sticking it in its own little box, separate from the rest of our unchanging request state.