[Mono-list] mono swallows threadpool exceptions

Stifu stifu at free.fr
Wed Jul 21 08:02:49 EDT 2010


Among the bugs I reported, the ones which tended to get fixed the fastest
were the ones I submitted patches for. :)
Not catching an Exception (or throwing one) sounds like a trivial patch, but
I could be wrong.


Daniel Hughes wrote:
> 
> And I found the bug.
> 
> Bug 491191
> 
> Which is over a year old.
> 
> This one is not in an obscure part of the framework like my serial
> port bug so it should be fixed quickly??
> 
> 
> 
> On Wed, Jul 21, 2010 at 10:21 PM, Daniel Hughes <trampster at gmail.com>
> wrote:
>> Ok I think I have it:
>>
>> http://msdn.microsoft.com/en-us/library/ms228965.aspx#ChangeFromPreviousVersions
>>
>> tells us that since .net 2.0 the runtime does not swallow threadpool
>> exceptions. So that means that the mono implementation is wrong.
>>
>> On Wed, Jul 21, 2010 at 9:51 PM, Daniel Hughes <trampster at gmail.com>
>> wrote:
>>> upon further reading this appears to be the correct behavior. Although
>>> it does not seem to be what is happening in .net I will need to do
>>> more investigation it seems.
>>>
>>> On Wed, Jul 21, 2010 at 9:16 PM, Daniel Hughes <trampster at gmail.com>
>>> wrote:
>>>> In trying to port our application to run on mono I have discovered
>>>> that mono is silently swallowing exceptions. This is a really big
>>>> deal, we expect these exceptions to bubble up and kill the
>>>> application.
>>>>
>>>> There is not even any indication that an exception has occurred it is
>>>> just lost.
>>>>
>>>>                public static void Main (string[] args)
>>>>                {
>>>>                        Action action = () =>
>>>>                        {
>>>>                                throw new Exception("this should Kill
>>>> the process but doesn't");
>>>>                        };
>>>>
>>>>                        ThreadPool.QueueUserWorkItem(_ => action());
>>>>                        while(true)
>>>>                        {
>>>>                                Thread.Sleep(1000);
>>>>                                Console.WriteLine("wrongly still
>>>> running");
>>>>                        }
>>>>                }
>>>>
>>>> The implications of this could be catastrophic. Imagine some code
>>>> which performs a check, finds bad data and throws an exception.
>>>> However mono swallows that exception so instead of the program closing
>>>> it carries on running and uses the bad data. This results in sensitive
>>>> data being lost. Or in our case a radio being bricked.
>>>>
>>>> Can someone explain why mono is doing this and if their is some
>>>> setting / environment variable I can change to make unhandled
>>>> threadpool exceptions terminate the process as is expected.
>>>>
>>>
>>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 

-- 
View this message in context: http://mono.1490590.n4.nabble.com/mono-swallows-threadpool-exceptions-tp2296815p2296994.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list