Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped timer can cause certificate to never update #350

Merged
merged 1 commit into from
May 23, 2022

Conversation

swenson
Copy link

@swenson swenson commented May 23, 2022

Once the time.NewTimer() expires, calls to timer.Stop() will return
false, but the channel will have nothing in it, causing <-timer.C to
hang forever.

This is hinted at by the docs, even though they suggest timer.Stop()
should return true in that case.

We change to a non-blocking drain so that we won't block forever.

This manifests in never updating the certificate after it expires,
causing TLS handshake errors.

Fixes #275

@swenson swenson requested review from tvoran and tomhjp May 23, 2022 18:12
Once the `time.NewTimer()` expires, calls to `timer.Stop()` will return
`false`, but the channel will have nothing in it, causing `<-timer.C` to
hang forever.

This is hinted at by the docs, even though they suggest `timer.Stop()`
should return true in that case.

We change to a non-blocking drain so that we won't block forever.

This manifests in never updating the certificate after it expires,
causing TLS handshake errors.

Fixes #275
@swenson swenson force-pushed the vault-3095/tls-handshake-error branch from d897a42 to 2ac3c06 Compare May 23, 2022 18:15
@swenson
Copy link
Author

swenson commented May 23, 2022

How to reproduce failure:

  • Set defaultLoopTime to 1 second
  • Set certificate expiration to 30 seconds
  • Deploy
  • Wait 65 seconds
  • Create a pod
  • Injector loop hangs forever

@swenson
Copy link
Author

swenson commented May 23, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TLS Handshake error with vault agent injector
3 participants