diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2019-11-04 12:10:03 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2019-11-04 12:10:03 -0700 |
commit | 27e288ab19a3a4d9243a8871d5b3c6426478e008 (patch) | |
tree | 885ac9a92f0f6a06a399e160b616b6a08b682af0 /modules/caddyhttp/reverseproxy/streaming.go | |
parent | 35f70c98fa1ea13882ee4f0406cd17f5545d0100 (diff) |
core: Synchronize calls to SetDeadline within fakeCloseListener
First evidenced in #2658, listener deadlines would sometimes be set
after clearing them, resulting in endless i/o timeout errors, which
leave all requests hanging. This bug is fixed by synchronizing the
calls to SetDeadline: when Close() is called, the deadline is first
set to a time in the past, and the lock is released only after the
deadline is set, so when the other servers break out of their Accept()
calls, they will clear the deadline *after* it was set. Before, the
clearing could sometimes come before the set, which meant that it was
left in a timeout state indefinitely.
This may not yet be a perfect solution -- ideally, the setting and
clearing of the deadline would happen exactly once per underlying
listener, not once per fakeCloseListener, but in rigorous testing with
these changes (comprising tens of thousands of config reloads), I was
able to verify that no race condition is manifest.
Diffstat (limited to 'modules/caddyhttp/reverseproxy/streaming.go')
0 files changed, 0 insertions, 0 deletions