[squid-dev] [PATCH] Fixed Write.cc:41 "!ccb->active()" assertion

Christos Tsantilas christos at chtsanti.net
Tue Nov 15 11:58:45 UTC 2016

Hi all,
  I applied the patch as r14945 with an r14946 fix.

Unfortunately while I was testing the Squid-3.5 variant of the patch I 
found a bug:
  When the Http::One::Server::writeControlMsgAndCall fails to write the 
control message, schedules a Comm::Write callback using just a 
ScheduleCallHere command.
The callback called without the CommIoCbParams details and squid is crashes.

There are two ways to fix this issue.
   1) complete the missing CommIoCbParams details inside 
   2) Make the ConnStateData::writeControlMsgAndCall to return false on 
failures and allow caller handle the failure.

This patch implements the (2) as I believe it is the better option.

My apologies for the buggy patch.

On 11/14/2016 08:03 PM, Christos Tsantilas wrote:
> The following sequence of events triggers this assertion:
>   - The server sends an 1xx control message.
>   - http.cc schedules ConnStateData::sendControlMsg call.
>   - Before sendControlMsg is fired, http.cc detects an error (e.g., I/O
> error or timeout) and starts writing the reply to the user.
>   - The ConnStateData::sendControlMsg is fired, starts writing 1xx, and
> hits the "no concurrent writes" assertion.
> We could only reproduce this sequence in the lab after changing Squid
> code to trigger a timeout at the right moment, but the sequence looks
> plausible. Other event sequences might result in the same outcome.
> To avoid concurrent writes, Squid now drops the control message if
> Http::One::Server detects that a reply is already being written. Also,
> ConnStateData delays reply writing until a pending control message write
> has been completed.
> There is strong possibility that the bug fixing this patch is a variant
> of the bug4174:
>   http://bugs.squid-cache.org/show_bug.cgi?id=4174
> However we are getting different backtrace.
> This is a Measurement Factory project.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix-r14945-assertion_failed_Write_cc_Not_ccb_active.patch
Type: text/x-patch
Size: 12186 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20161115/fcfd5b31/attachment.bin>

More information about the squid-dev mailing list