Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/fatal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ fatal(const char *message)

storeDirWriteCleanLogs(0);

RunRegisteredHere(RegisteredRunner::finishShutdown);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to being eliminated completely, fatal() and friends should eventually become an equivalent of "abort() without dumping core"1 -- an "immediate" and safe death with minimal reporting. This change moves Squid deeper into the opposite direction. No rationale has been provided to justify making things worse.

Footnotes

  1. Calls like std::terminate, std::exit(), and std::_Exit() should be evaluated to find the best match.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are certain system resources (eg listening ports, logs) which still should be released even when an abort() is happening. The criteria for finishShutdown runner fits well with the abort() situation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OS will take care of basic resources. No internal action is safe when "an abort() is happening". Nothing should be released by Squid itself when abort() is happening.


fatal_common(message);

exit(EXIT_FAILURE);
Expand Down Expand Up @@ -95,6 +97,8 @@ fatal_dump(const char *message)
if (opt_catch_signals)
storeDirWriteCleanLogs(0);

RunRegisteredHere(RegisteredRunner::finishShutdown);

Debug::PrepareToDie();
abort();
}
Expand Down
2 changes: 2 additions & 0 deletions src/tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ death(int sig)

storeDirWriteCleanLogs(0);

RunRegisteredHere(RegisteredRunner::finishShutdown);

if (!shutting_down) {
PrintRusage();

Expand Down
Loading