influxdata / influxdata/influxdb
http server does not set ReadTimeout
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Version 1.7.x
https://github.com/influxdata/influxdb/blob/186289da56221340c57b24d1bec1f375e874ce9a/services/httpd/handler.go#L843-L855
On line 843, ReadFrom() may read data from underlying tcp connection but it does not set a deadline. This may be a problem if the connection is half-open(say, the client is powered down or the network is not reachable). The read() would block for a long time, maybe a couple of days.
If a concurrent-write-limit is set, such a connection would occupy a slot. Eventually it may fail to handle any write if half-open connections accumulate.
A proposal is to set ReadTimeout for the http server so it can recover and close the connection. The ReadTimeout should be longer than enqueued-write-timeout.
Contributor guide
Research direction
Read services/httpd/handler.go at lines 843-855 and trace the HTTP server setup and existing enqueued-write-timeout handling. Verify how a half-open connection can block ReadFrom, then ensure the server's ReadTimeout is longer than the enqueued-write-timeout and prevents indefinite reads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100