unhandled exception caught by .so's handler causes infinite loop
Original Reporter info from Mantis: sethdgrover@gmail.com
-
Reporter name: Seth Grover
Original Reporter info from Mantis: sethdgrover@gmail.com
- Reporter name: Seth Grover
Description:
I'm logging this bug after mentioning it on the mailing list and receiving Jonas' response (see http://lists.freepascal.org/lists/fpc-pascal/2010-September/026405.html ).
If a shared object library compiled in FPC under Linux installs its signal handler with HookSignal(RTL_SIGDEFAULT) and then an unhandled access violation occurs (either in the calling program or in the .so outside of a try/except block) then the .so will put the program into an infinite loop of raising runtime error 217 and access violations.
Jonas says (http://lists.freepascal.org/lists/fpc-pascal/2010-September/026408.html ) this is caused by revision 14184 (http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=rev&revision=14184 ) which is a response to bug #14958 (closed), quote, "The problem is probably that the lib's exit code is called both when the library is unloaded (in which case you don't want the process to terminate) and when the "library" terminates (either via an unhandled exception, or by calling halt)."
Steps to reproduce:
- Create a .so under Linux with FPC.
- In the initialization code for the .so, call HookSignal(RTL_SIGDEFAULT);
- In some routine in the .so, cause a segfault outside of the context of
a try/except block.
- In some calling program (C or FPC, doesn't matter) call that routine
results:
you will see an infinite printout of runtime error 217 and access violations.
Mantis conversion info:
- Mantis ID: 17383
- OS: Linux
- OS Build: Ubuntu 10.04
- Build: tags/release_2_4_2_rc1 rev 15922
- Platform: i386 and x86_64
- Version: 2.4.3
- Fixed in version: 2.6.0
- Fixed in revision: 16418 (#1f61b5b3)
- Monitored by: » sethdgrover@gmail.com (Seth Grover)