这是indexloc提供的服务,不要输入任何密码
Skip to content

Handle zero-byte TCP healthcheck connections #236

@nimjor

Description

@nimjor

In an environment like kubernetes hosted on AWS, the server needs to handle health checks from load balancers. A TCP health check only checks that a connection can be established, and then closes without sending any data or waiting for a greeting. go-smtp's Server then logs error messages like

handler error: read tcp 127.0.0.1:9025->127.0.0.1:55372: read: connection reset by peer

which in the case of most health check intervals (< 5 min) means noisy logs with lots of pointless error messages (the noise is the problem, not any functionality of the Server itself). Instead, Server.handleConn() should check whether any bytes were sent and only log an error if the connection was non-empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions