apiserver: fix the data race for tls.Config #2717

Merged
merged 1 commit into from Jul 3, 2015

Conversation

Projects
None yet
2 participants
Contributor

mjs commented Jul 3, 2015

Each connection gets a private copy of the tls.Config so that only future connections are affected by certificate updates. This avoids the race and is just generally safer.

Also simplify the changeCertListener somewhat.

This also fixes a serious bug recently introduced in c147767. The addition of the Lock call at the top of processCertChanges caused the cert update to hang when updateCertificate tries to grab the lock again.

(Review request: http://reviews.vapour.ws/r/2095/)

apiserver: fix the data race for tls.Config
Each connection gets a private copy of the tls.Config so that only
future connections are affected by certificate updates. This avoids
the race and is just generally safer.

Also simplify the changeCertListener somewhat.

This also fixes a serious bug recently introduced in c147767. The
addition of the Lock call at the top of processCertChanges caused the
cert update to hang when updateCertificate tries to grab the lock
again.
Contributor

mjs commented Jul 3, 2015

$$merge$$

Contributor

jujubot commented Jul 3, 2015

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

jujubot added a commit that referenced this pull request Jul 3, 2015

Merge pull request #2717 from mjs/certupdater-race-fix
apiserver: fix the data race for tls.Config

Each connection gets a private copy of the tls.Config so that only future connections are affected by certificate updates. This avoids the race and is just generally safer.
    
Also simplify the changeCertListener somewhat.
    
This also fixes a serious bug recently introduced in c147767. The addition of the Lock call at the top of processCertChanges caused the cert update to hang when updateCertificate tries to grab the lock again.

(Review request: http://reviews.vapour.ws/r/2095/)

@jujubot jujubot merged commit d357222 into juju:master Jul 3, 2015

@mjs mjs deleted the mjs:certupdater-race-fix branch Jul 3, 2015

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