]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 4156: comm.cc "!commHasHalfClosedMonitor(fd)" assertion (#1443)
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 11 Sep 2023 07:49:36 +0000 (07:49 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 12 Sep 2023 20:48:45 +0000 (20:48 +0000)
commit5da786ef2a708559f5b53a05b7db6de0b64ce885
tree3ae3c9b1005baf5de8064c0bae81f2b50f10d14c
parentef959d6e9e3eaec762d68b96af272e39cd000799
Bug 4156: comm.cc "!commHasHalfClosedMonitor(fd)" assertion (#1443)

This bug is specific to "half_closed_clients on" configurations.

    assertion failed: ... "isOpen(fd) && !commHasHalfClosedMonitor(fd)"
    location: comm.cc:1583 in commStartHalfClosedMonitor()

Squid asserts because Server schedules comm_read() after receiving EOF:
That extra read results in another EOF notification, and an attempt to
start monitoring an already monitored half-closed connection.

Upon detecting a potentially half-closed connection,
Server::doClientRead() should clear flags.readMore to prevent Server
from scheduling another comm_read(), but it does not and cannot do that
(without significant refactoring) because

* Server does not have access to flags.readMore
* flags.readMore hack is used for more than just "read more"

We worked around the above limitation by re-detecting half-closed
conditions and clearing flags.readMore after clientParseRequests(). That
fixed the bug but further increased poor code duplication across
ConnStateData::afterClientRead() and ConnStateData::kick() methods. We
then refactored by merging and moving that duplicated code into
clientParseRequests() and renamed that method to make backports safer.
src/client_side.cc
src/client_side.h
src/tests/stub_client_side.cc