Skip to Content [alt-c]

Comment

In reply to Comment by Reader Ameya

Andrew Ayer on 2020-06-27 at 14:21:

Thanks, Ameya! You raise a good point about leaking connections but it's unfortunately not that simple to fix. I want to avoid deadlines because the proxy should be able to handle any type of protocol, and some protocols might legitimately have long periods of inactivity. Instead, it should be the backend's responsibility to close idle connections and the proxy should detect when that has happened.

Unfortunately, Go provides no way to detect when a connection has been fully closed without trying to write at least one byte to it, which isn't sufficient because the proxy doesn't always have a byte to write. On Unix, closure can be detected without writing by polling the socket with events=0 and looking for POLLHUP in revents. I'm exploring possible solutions and plan to publish a blog post about it.

Reply

Post a Reply

Your comment will be public. If you would like to contact me privately, please email me. Please keep your comment on-topic, polite, and comprehensible.

(Optional; will be published)

(Optional; will not be published)

(Optional; will be published)

  • Blank lines separate paragraphs.
  • Lines starting with ">" are indented as block quotes.
  • Lines starting with two spaces are reproduced verbatim.
  • Text surrounded by *asterisks* is italicized.
  • Text surrounded by `back ticks` is monospaced.
  • URLs are turned into links.
  • Use the Preview button to check your formatting.