CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Error%7eerror triggers crash after handling exceptions thrown by errorexit twice (http://www.cfd-online.com/Forums/openfoam-bugs/62550-error-7eerror-triggers-crash-after-handling-exceptions-thrown-errorexit-twice.html)

7islands September 3, 2007 10:16

Description: The delete messa
 
Description:
The delete messageStreamPtr_; line in error::~error() triggers crash after handling *this object thrown in error::exit() twice if throwExceptions_ is set to true. I think this is because throw *this; in error::exit() actually throws a temporary bitwise copy of *this (even if the object is caught by reference), and the destructor of the temporary object deletes *messageStreamPtr_ of the static object FatalError or FatalIOError (which must not be deleted except when the application terminates). Thus, the first exception handling deletes *messageStreamPtr_, while the second one triggers crash trying to delete the already deleted *messageStreamPtr_.

Solver/Application:
All that sets FatalError.throwExceptions() and FatalIOError.throwExceptions().

Source file:
src/OpenFOAM/db/error/error.C

Testcase:
I'm not sure if you get the description above... I'll be posting a testcase if that is the case.

Platform:
linux64

Version:
1.4

Notes:

henry September 3, 2007 17:16

Thanks for the detailed bug re
 
Thanks for the detailed bug report. To fix this bug in OpenFOAM version 1.4.1 replace OpenFOAM-1.4.1/src/OpenFOAM/db/error/error.H with http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif error.H , OpenFOAM-1.4.1/src/OpenFOAM/db/error/error.C with http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif error.C and OpenFOAM-1.4.1/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H with http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif OStringStream.H and recompile the OpenFOAM library.

7islands September 4, 2007 05:24

Tried the fix with 1.4.1. It w
 
Tried the fix with 1.4.1. It works perfectly. Thanks!

Takuya


All times are GMT -4. The time now is 15:38.