[squid-dev] [PATCH] VIA creation code duplication

Alex Rousskov rousskov at measurement-factory.com
Thu Mar 16 17:17:36 UTC 2017

On 03/16/2017 05:15 AM, Amos Jeffries wrote:

> Any objections to applying this with this added:
>   // XXX: putStr() still has String 64KB limits
>   Must(strVia.length() < 64*1024);

No objections from me if you replace the magic constant with a new
inlined String::MaxSizeXXX() method. The slightly misleading source code
comment above becomes unnecessary after that. Why XXX()? Because no
correct caller code should know about internal String limits (but it may
catch exceptions, including exceptions due to those limits).

> (I kind of hate those low-level operations with Must() and assert() like
> the former - far too little context to be useful debugging with such big
> impact when they are triggered.)

While it is indeed tempting to hate those Must(), we must keep in mind
that low-level assert-replacing Must()s are not meant for debugging or
even traditional error handling. Their purpose is to (hopefully) prevent
Squid death.

When the crash avoidance project completes, we will have a way to dump
stack traces for specific Must()s, which will provide the same level of
triage info as an assert() would, but (hopefully) without killing Squid
in environments where such functionality is supported.



More information about the squid-dev mailing list