Backport state pool leak fixes to 2.0 branch #6713

Merged
merged 4 commits into from Dec 15, 2016

Conversation

Projects
None yet
2 participants
Member

babbageclunk commented Dec 15, 2016

Fix state pool leaks (gets without corresponding releases) from code using the httpContext methods to get a state object. Backports of #6566 and #6703 to the 2.0 branch.

Fixes https://bugs.launchpad.net/juju/+bug/1641824 - although migrations aren't available in 2.0, the state pool would also leak when models are destroyed.

babbageclunk added some commits Nov 15, 2016

Fix StatePool leaks
Part of http://pad.lv/1641824 - the migration back doesn't work because
the state references in the pool never get to 0, so they're marked for
removal but not actually removed.

Ensure that state references returned from
httpContext.stateForRequestUnauthenticated get released back to the
StatePool when they're finished with.

In the logstream handler. since the state is created in the newSource
closure and returned, the normal defer method doesn't work. Change
newSource to also return a closer function that will release the state
back to the pool and call that closer func from
logStreamRequestHandler.close().
Ensure resource HTTP handlers release state
Thread the call to httpContext.release through so it can be called from
the right place in the resource HTTP handler.
Close state leaks from the NewResourceOpener code
This code path is a bit trickier to close than the other handler.
Member

babbageclunk commented Dec 15, 2016

!!build!!

Member

babbageclunk commented Dec 15, 2016

$$merge$$

Contributor

jujubot commented Dec 15, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Dec 15, 2016

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/9884

Member

babbageclunk commented Dec 15, 2016

Spurious lxd failure.

$$merge$$

Contributor

jujubot commented Dec 15, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 694df72 into juju:2.0 Dec 15, 2016

1 check failed

github-check-merge-juju Built PR, ran unit tests, and tested LXD deploy. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details

@babbageclunk babbageclunk deleted the babbageclunk:resource-state-leak-2.0 branch Dec 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment