Why FailedAssertion is not my favorite exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Noble Creators of the Squid Cybernetic Swimming in a Distributed Data Sea,

There is a spectre haunting src/common/assert.cc: The spectre of throw
FailedAssertion.

This seemingly inconsequential yet villainous statement destroys the
stack frame in which a failing assert statement is evaluated-- a stack
frame of great interest to those hoping to divine the cause of such
failures-- at the moment of their detection.

This consequence follows from the hope that some caller might be able to
catch and recover from the failure. That is an unworthy goal, for any
failure sufficiently dire to rate an 'assert' is a failure from which
there can be no recovery. As I survey the code, I see FailedAssertion
is only caught as part of unit tests and in a few small programs where
it lead to an immediate exit.

Therefore! If there is no objection, I would like to submit a patch that
will replace 'throw FailedException' with abort(). In support of this
goal, the patch will also remove attempts to catch FailedException from
driver programs like librados-config and change tests expecting a throw
of FailedAssertion to use the EXPECT_DEATH or ASSERT_DEATH macros instead.

These changes, taken together, should be non-disruptive and make
debugging easier.

Thank you all.

-- 
Senior Software Engineer           Red Hat Storage, Ann Arbor, MI, US
IRC: Aemerson@{RedHat, OFTC, Freenode}
0x80F7544B90EDBFB9 E707 86BA 0C1B 62CC 152C  7C12 80F7 544B 90ED BFB9

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux