]> git.ipfire.org Git - thirdparty/squid.git/commit
Do not allow low-level debugging to hide important/critical messages.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 20 May 2016 13:20:27 +0000 (01:20 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 20 May 2016 13:20:27 +0000 (01:20 +1200)
commit014adac1c52c2f7dabee4cf6361dec4f4207f41a
treea9a42f25f113576f39365ccf607fc40bd535cba7
parent00237269110b6d9661457a7f8baa4c6450ded737
Do not allow low-level debugging to hide important/critical messages.

Removed debugs() side effects that inadvertently resulted in some
important/critical messages logged at the wrong debugging level and,
hence, becoming invisible to the admin. The removed side effects set the
"current" debugging level when a debugs() parameter called a function
that also called debugs(). The last nested debugs() called affected the
level of all debugs() still in progress!

Related changes:

* Reentrant debugging messages no longer clobber parent messages. Each
  debugging message is logged separately, in the natural order of
  debugs() calls that would have happened if debugs() were a function
  (that gets already evaluated arguments) and not a macro (that
  evaluates its arguments in the middle of the call). This order is
  "natural" because good macros work like functions from the caller
  point of view.

* Assertions hit while evaluating debugs() parameters are now logged
  instead of being lost with the being-built debugs() log line.

* 10-20% faster debugs() performance because we no longer allocate a new
  std::ostringstream buffer for the vast majority of debugs() calls.
  Only reentrant calls get a new buffer.

* Removed old_debug(), addressing an old "needs to die" to-do.

* Removed do_debug() that changed debugging level while testing whether
  debugging is needed. Use side-effect-free Debug::Enabled() instead.

Also removed the OutStream wrapper class. The wrapper was added in trunk
revision 13767 that promised to (but did not?) MemPool the debug output
buffers. We no longer "new" the buffer stream so a custom new() method
would be unused. Besides, the r13767 explanation implied that providing
a Child::new() method would somehow overwrite Parent::allocator_type,
which did not compute for me. Finally, Squid "new"s other allocator-
enabled STL objects without overriding their new methods so either the
same problem is still there or it did not exist (or was different?).

Also removed Debug::xassert() because the debugs() assertions now work
OK without that hack.
src/Debug.h
src/adaptation/ecap/Host.cc
src/base/Lock.h
src/client_side.cc
src/debug.cc
src/esi/Expression.cc
src/security/NegotiationHistory.cc
src/servers/FtpServer.cc
src/ssl/support.cc
src/tests/stub_debug.cc