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

trigger-http: Log TLS startup errors instead of propagating #2230

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Conversation

lann
Copy link
Collaborator

@lann lann commented Jan 18, 2024

This prevents TLS handshake errors from exiting the server loop.

Signed-off-by: Lann Martin <lann.martin@fermyon.com>
@lann lann requested review from dicej and rylev January 23, 2024 14:28
@@ -344,8 +344,10 @@ impl HttpTrigger {

loop {
let (stream, addr) = listener.accept().await?;
let stream = acceptor.accept(stream).await?;
Self::serve_connection(self_.clone(), stream, addr);
match acceptor.accept(stream).await {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If acceptor.accept is a bad state where it will always error this might just turn into an infinite loop no? Should we log and return the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that should be an issue with the TLS acceptor. Note that the TCP listener just above does still bail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about the TLS acceptor to say whether this is fine to do or not. I can't really give too much more of opinion without knowing why we don't want to propagate errors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TLS acceptor handles the TLS handshake. It could fail because of an underlying TCP error but it can also fail because the handshake cannot be completed (for any number of reasons, some of which aren't under the server's control). Any error that is permanently fatal to the TCP listener should fail on the next loop iteration's call to listener.accept.

@lann lann merged commit 93d22a9 into main Jan 25, 2024
11 checks passed
@lann lann deleted the tls-log branch January 25, 2024 18:42
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.

3 participants