]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 4796: comm.cc !isOpen(conn->fd) assertion when rotating logs (#474)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Sat, 29 Feb 2020 05:59:35 +0000 (05:59 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 29 Feb 2020 10:03:37 +0000 (10:03 +0000)
commitd7ca82e66dadd85b96b7b2f21866c92e745921ef
tree57b1cafbbdf28e8412b2ac56577232cccb0da526
parentf319174df468d72928a09548ca89baf6873378ad
Bug 4796: comm.cc !isOpen(conn->fd) assertion when rotating logs (#474)

This long-term solution overrides the short-term fix at 2cd72a2. Now,
debug.cc correctly maintains meta information associated with its file
descriptors.

IMO, the correct place for calling _db_init() is just after locking the
PID file because we want to log ASAP, but cache.log is a common resource
that requires protection. Thus, the two old _db_init() calls were both
excessive and misplaced:

* The first call happens too early, allowing another Squid instance to
  pollute cache.log with messages unrelated to the cache.log-owning
  instance (e.g., a "FATAL: Squid is already running" message when
  attempting to start another instance).

* The second call happens too late, missing earlier debugs() that ought
  to be written into cache.log (e.g., debugs() in comm_init()).

Fixing _db_init() calls led to adjustments like moving mainSetCwd() to
be called prior to the relocated _db_init(). However, these changes
should not affect chroot-sensitive code such as UseConfigRunners().

Some early debugs() messages are no longer written into cache.log:

* Exception messages like "Squid is already running" emitted by another
  Squid instance. This is an improvement: Messages about other instances
  do not belong to the cache.log locked by the running instance.

* Messages (mostly errors and warning) from "finalizeConfig" callers
  (e.g., "WARNING: mem-cache size is too small..."). This loss is
  regrettable. Long-term, these messages should be reported after
  configuration is finalized (TODO). Delayed reporting will also help
  when Squid starts rejecting invalid reconfigurations.

* Messages from a few early enter_suid()/leave_suid() calls, such as
  "enter_suid: PID" and "leave_suid: PID". This is an improvement: These
  debugging messages pollute cache.log.

* A few early SquidMain() messages emitted between parseConfigFile() and
  StartUsingConfig() (e.g., "Doing post-config initialization"). This is
  an improvement: These debugging messages pollute cache.log.

Also removed outdated 'TEST_ACCESS' hack for simplicity sake.

Also marked an old XXX: Chrooted SMP master process does not db_init().
src/cache_cf.cc
src/comm.cc
src/debug.cc
src/fde.cc
src/fde.h
src/icmp/Makefile.am
src/main.cc
src/tests/testRock.cc
src/tests/testUfs.cc