defer StackOverflow exceptions (rather than dropping them) when exceptions are masked
See http://www.reddit.com/r/haskell/comments/1luan1/strange_io_sequence_behaviour/ for a very simple program (
main') that accidentally evades the stack size limit, running to completion even though it has allocated hundreds of megabytes of stack chunks, and my comment for an explanation of this behavior.
ryani suggested that when a thread exceeds its stack limit but it is currently blocking exceptions, the RTS shouldn't simply drop the
StackOverflow exception, but rather deliver it when the
mask operation completes. That sounds sensible to me and it would give a nice guarantee that when any individual
mask operation uses a small amount of stack, the stack size limit is approximately enforced.
(I know that the default stack size limit may go away or essentially go away, but it can still be nice when developing to use a small stack size limit, so that one's system isn't run into the ground by infinite recursion quickly gobbling up tons of memory.)