Re: async-calls squid3/src debug.cc,1.18.4.4,1.18.4.5 Debug.h,1.10.4.3,1.10.4.4 main.cc,1.89.4.7,1.89.4.8 structs.h,1.116.4.3,1.116.4.4 cf.data.pre,1.155.4.3,1.155.4.4

From: Adrian Chadd <adrian@dont-contact.us>
Date: Sat, 23 Feb 2008 03:34:19 -0700

Can someone please explain the logic behind this?
I think I understand, but I'd like to know what people are trying
to achieve.

Adrian

On Sat, Feb 23, 2008, chtsanti wrote:
> Update of cvs.devel.squid-cache.org:/cvsroot/squid/squid3/src
>
> Modified Files:
> Tag: async-calls
> debug.cc Debug.h main.cc structs.h cf.data.pre
> Log Message:
> - Add TheAssertsPerStep counter to count the number of assertions per
> single main loop iteration. This counter is reset to zero at the
> beginning of every main loop iteration.
>
> - To reset the TheAssertsPerStep counter a new AsyncEngine based class used,
> the XAssertsEngine.
>
> - Add "assert_burst_max <int>" to squid.conf. If TheAssertsPerStep
> counter exceeds a non-negative assert_burst_max, we abort().
> If set to zero, the first assertion aborts Squid, giving users the old
> behavior. If set to a negative number, there is no limit.
>
>
>
> Index: cf.data.pre
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/cf.data.pre,v
> retrieving revision 1.155.4.3
> retrieving revision 1.155.4.4
> diff -C2 -d -r1.155.4.3 -r1.155.4.4
> *** cf.data.pre 12 Feb 2008 19:04:39 -0000 1.155.4.3
> --- cf.data.pre 23 Feb 2008 10:31:18 -0000 1.155.4.4
> ***************
> *** 5610,5612 ****
> --- 5610,5628 ----
> DOC_END
>
> + NAME: assert_burst_max
> + TYPE: int
> + LOC: Config.assert_burst_max
> + DEFAULT: 100
> + DOC_START
> + When this is set to a possitive number then Squid will abort
> + if an assertions burst exceeds this number.
> + If set to zero, the first assertion aborts Squid, giving users
> + the old behavior. If set to a negative number, there is no
> + limit.
> + An asssertions burst defined as the number of assertions per
> + single Squid main loop iteration.
> + WARNING! This is an experimental feature and the definition
> + of a "burst" can change
> + DOC_END
> +
> EOF
>
> Index: main.cc
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/main.cc,v
> retrieving revision 1.89.4.7
> retrieving revision 1.89.4.8
> diff -C2 -d -r1.89.4.7 -r1.89.4.8
> *** main.cc 12 Feb 2008 19:05:00 -0000 1.89.4.7
> --- main.cc 23 Feb 2008 10:31:18 -0000 1.89.4.8
> ***************
> *** 144,147 ****
> --- 144,158 ----
> };
>
> + class XAssertsEngine : public AsyncEngine
> + {
> +
> + public:
> + int checkEvents(int timeout)
> + {
> + TheAssertsPerStep = 0;
> + return EVENT_IDLE;
> + };
> + };
> +
> class SignalEngine: public AsyncEngine
> {
> ***************
> *** 1297,1300 ****
> --- 1308,1314 ----
> mainLoop.registerEngine(&signalEngine);
>
> + XAssertsEngine xassertsEngine;
> + mainLoop.registerEngine(&xassertsEngine);
> +
> /* TODO: stop requiring the singleton here */
> mainLoop.registerEngine(EventScheduler::GetInstance());
>
> Index: debug.cc
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/debug.cc,v
> retrieving revision 1.18.4.4
> retrieving revision 1.18.4.5
> diff -C2 -d -r1.18.4.4 -r1.18.4.5
> *** debug.cc 16 Feb 2008 21:06:42 -0000 1.18.4.4
> --- debug.cc 23 Feb 2008 10:31:18 -0000 1.18.4.5
> ***************
> *** 45,48 ****
> --- 45,49 ----
> int TheCascadingAsserts = 0;
> int TheSalvagedAsserts = 0;
> + int TheAssertsPerStep = 0;
>
> static char *debug_log_file = NULL;
> ***************
> *** 591,606 ****
> xassert(const char *msg, const char *file, int line) {
>
> ! if (TheCascadingAsserts < MAX_CASCADING_ASSERTS && AsyncCall_Handling_Exceptions) {
> TheCascadingAsserts++;
> TheSalvagedAsserts++;
> ! debugs(0, 0, "assertion failed: " << file << ":" << line << ": \"" << msg << "\". Trying to survive. Salvaged assertions: " << TheSalvagedAsserts);
>
> throw TextException(msg, file, line);
> }
>
> - debugs(0, 0, "assertion failed: " << file << ":" << line << ": \"" << msg << "\"");
>
> if(TheCascadingAsserts >= MAX_CASCADING_ASSERTS)
> ! debugs(0, 0, "I am dying after " << TheCascadingAsserts << "cascading assertions!" );
>
> if (!shutting_down)
> --- 592,619 ----
> xassert(const char *msg, const char *file, int line) {
>
> ! debugs(0, 0, "assertion failed: " << file << ":" << line << ": \"" << msg << "\"");
> !
> ! if (AsyncCall_Handling_Exceptions &&
> ! TheCascadingAsserts < MAX_CASCADING_ASSERTS &&
> ! ( Config.assert_burst_max < 0 ||
> ! (Config.assert_burst_max > 0 && TheAssertsPerStep < Config.assert_burst_max)
> ! )
> ! ) {
> TheCascadingAsserts++;
> TheSalvagedAsserts++;
> ! TheAssertsPerStep++;
> !
> ! debugs(0, 0, "salvaging assertion #" << TheSalvagedAsserts << " (" <<
> ! TheAssertsPerStep << "/" << Config.assert_burst_max << ")");
>
> throw TextException(msg, file, line);
> }
>
>
> if(TheCascadingAsserts >= MAX_CASCADING_ASSERTS)
> ! debugs(0, 0, "dying after " << TheCascadingAsserts << "cascading assertions" );
> !
> ! if(Config.assert_burst_max > 0 && TheAssertsPerStep >= Config.assert_burst_max)
> ! debugs(0, 0, "dying after an " << TheAssertsPerStep << " assertions burst" );
>
> if (!shutting_down)
>
> Index: Debug.h
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/Debug.h,v
> retrieving revision 1.10.4.3
> retrieving revision 1.10.4.4
> diff -C2 -d -r1.10.4.3 -r1.10.4.4
> *** Debug.h 14 Feb 2008 21:46:38 -0000 1.10.4.3
> --- Debug.h 23 Feb 2008 10:31:18 -0000 1.10.4.4
> ***************
> *** 55,58 ****
> --- 55,60 ----
> void WillCatchException(int debug_section, int debug_level, const char *who);
> void WontCatchException();
> + extern int TheSalvagedAsserts;
> + extern int TheAssertsPerStep;
>
> /* defined names for Debug Levels */
>
> Index: structs.h
> ===================================================================
> RCS file: /cvsroot/squid/squid3/src/structs.h,v
> retrieving revision 1.116.4.3
> retrieving revision 1.116.4.4
> diff -C2 -d -r1.116.4.3 -r1.116.4.4
> *** structs.h 12 Feb 2008 19:05:14 -0000 1.116.4.3
> --- structs.h 23 Feb 2008 10:31:18 -0000 1.116.4.4
> ***************
> *** 693,696 ****
> --- 693,697 ----
>
> char *accept_filter;
> + int assert_burst_max;
> };
>
Received on Sat Feb 23 2008 - 03:34:20 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST