Red Hat Bugzilla – Bug 114699
Cancellation during exception handling calls terminate()
Last modified: 2007-11-30 17:10:35 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
rv:1.5) Gecko/20031007 Firebird/0.7
Description of problem:
If a cancellation request is received while handling an exception,
std::terminate() will be called. This is quite bad since it means I
can't safely call close() when handling an IO exception, etc.
I tested for this behavior since cancellation is now handled as an
exception, and C++ can have only one active exception. Could
cancellation be disabled for the duration of the exception handling to
avoid this problem?
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Compile and run attached test program.
Actual Results: $ ./test_cancellation_while_throwing
terminate called without an active exception
Expected Results: The thread is not cancelled, since cancellation can
not safely happen during the exception handling, and there are no
cancellation points in my test code after the exception handling.
Created attachment 97393 [details]
Of course it is possible to call interfaces which are cancellation
points in exception handlers. Just disable cancellation first.
I don't see us putting any more effort into the C++ handling. The
situation is hopeless since there is no cooperation from the C++
maintainers forthcoming. I'll keep the bug open but mark it as an
enhancements (which it is).
Actually, it's better served by closing as DEFERRED. Once upstream gcc C++
handles thing correctly you can file an RFE.