[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Re: ContextSwitchDeadlock was detected

kumari sony

9/27/2011 8:00:00 AM

Simply select Exceptions from the Debug menu in the visual studio 2005 window , the Edxception Dialog box wil popup , select the Managed Debugging Assistants Exception Node , then select ContextSwitchDeadlock and remove the select from Thrown column . this will stop the vs from throwing the ContextSwitchDeadlock exception.


Hope it helps...

> On Tuesday, June 12, 2007 1:49 PM Srima wrote:

> Hi,
> I believe this is a framework level issue. I am not sure. Pls help me.
> Developement Evn:
> ================
> Vb.net 2005( framework 2.0)
>
> Error:
> ==========
> ContextSwitchDeadlock was detected
> Message: The CLR has been unable to transition from COM context 0x1b2938 to
> COM context 0x1b2aa8 for 60 seconds. The thread that owns the destination
> context/apartment is most likely either doing a non pumping wait or
> processing a very long running operation without pumping Windows messages.
> This situation generally has a negative performance impact and may even lead
> to the application becoming non responsive or memory usage accumulating
> continually over time. To avoid this problem, all single threaded apartment
> (STA) threads should use pumping wait primitives (such as
> CoWaitForMultipleHandles) and routinely pump messages during long running
> operations.
>
> Regards,
> Sri


>> On Tuesday, June 12, 2007 2:01 PM Peter Duniho wrote:

>> On Tue, 12 Jun 2007 10:49:00 -0700, Sriman =
>>
>> <Sriman@discussions.microsoft.com> wrote:
>>
>> e.
>>
>> When did you get the error?
>>
>> I see that on a semi-regular basis if I am debugging particular kinds of=
>> =
>>
>> code and have been spending any significant amount of time (for example,=
>> =
>>
>> more than 60 seconds :) ) with the process stopped.
>>
>> As near as I can tell it's a false-positive error message.
>>
>> If you are seeing it in a different type of situation, particularly if y=
>> ou =
>>
>> have no good explanation for why a particular thread would remain stoppe=
>> d =
>>
>> for a minute or more, then you should look into it. Otherwise, there's =
>> =
>>
>> probably nothing to worry about.
>>
>> (In fact, I simply disabled the error message, because if I really do ha=
>> ve =
>>
>> a deadlock situation in my code somewhere, I will notice it for reasons =
>> =
>>
>> other than geting the MDA message).
>>
>> Pete


>>> On Tuesday, June 12, 2007 2:15 PM Srima wrote:

>>> Actually I am working on exporting and importing the data from MySql
>>> database(thru ODBC) to SqlServer 2005(Sqlclient). I can not tell exactly
>>> where i am getting this error. I got this error in release mode also. even i
>>> am unable to catch that exception also. I didn't see the errors, when i ran
>>> the exe directly.
>>> How did you disable the errors? do you mean try..catch? Please clarify..
>>>
>>>
>>> Regards,
>>> Sri.
>>>
>>> "Peter Duniho" wrote:


>>>> On Tuesday, June 12, 2007 2:15 PM Srima wrote:

>>>> Actually I am working on exporting and importing the data from MySql
>>>> database(thru ODBC) to SqlServer 2005(Sqlclient). I can not tell exactly
>>>> where i am getting this error. I got this error in release mode also. even i
>>>> am unable to catch that exception also. I didn't see the errors, when i ran
>>>> the exe directly.
>>>> How did you disable the errors? did you mean try..catch? Please clarify..
>>>>
>>>>
>>>> Regards,
>>>> Sri.
>>>> "Peter Duniho" wrote:


>>>>> On Tuesday, June 12, 2007 3:02 PM Peter Duniho wrote:

>>>>> On Tue, 12 Jun 2007 11:15:02 -0700, Sriman
>>>>> <Sriman@discussions.microsoft.com> wrote:
>>>>>
>>>>>
>>>>> The "ContextSwitchDeadlock" error is, as far as I know, _only_ available
>>>>> as a "Managed Debugging Assistant". You can disable it by looking under
>>>>> that section in the "Debug/Exception..." dialog box. However, you should
>>>>> only ever see it when you are actually debugging. If you run your
>>>>> application without the debugger, it shouldn't happen.
>>>>>
>>>>> Are you seeing this MDA appear at times when you are not using the
>>>>> debugger? If so, I'm afraid I don't have any idea of what's going on. I
>>>>> didn't even realize that the MDA exceptions could happen when not using
>>>>> the debugger.
>>>>>
>>>>> Pete


>>>>>> On Tuesday, June 12, 2007 3:23 PM Srima wrote:

>>>>>> Hi peter,
>>>>>>
>>>>>> Thanks for the response. Yes, I can see the eror with out debugger
>>>>>> also(run the application using IDE in Release mode(No debug marks)). No
>>>>>> errors If i run the exe direct from the release folder.
>>>>>>
>>>>>> Regards,
>>>>>> Sriman.
>>>>>>
>>>>>> "Peter Duniho" wrote:


>>>>>>> On Tuesday, June 12, 2007 8:58 PM Peter Duniho wrote:

>>>>>>> On Tue, 12 Jun 2007 12:23:07 -0700, Sriman
>>>>>>> <Sriman@discussions.microsoft.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>> It's not clear that you understand my question.
>>>>>>>
>>>>>>> If you run your program by using the Visual Studio IDE, then you are
>>>>>>> running with the debugger. The debugger is attached, whether you realize
>>>>>>> it or not.
>>>>>>>
>>>>>>>
>>>>>>> In other words, without the debugger the error doesn't happen.
>>>>>>>
>>>>>>> Now, all that said, if you are not actually interrupting your program with
>>>>>>> the debugger or otherwise doing something that would be expected and
>>>>>>> normally cause a thread to remain active in preference for another thread
>>>>>>> in your application, then perhaps the error is telling you something
>>>>>>> useful.
>>>>>>>
>>>>>>> Note that an "expected and normal" situation might be, for example, making
>>>>>>> a database query that takes a very long time. I don't know what sort of
>>>>>>> query this might be, but maybe something that tries to extract all of the
>>>>>>> data from a very large data, for example.
>>>>>>>
>>>>>>> Only you can really decide for sure whether the error is of concern or
>>>>>>> not, since only you can judge whether it's reasonable for your application
>>>>>>> to remain stuck in one thread for a long time. If it's not okay, then you
>>>>>>> should probably look closer at which threads the debugger is talking about
>>>>>>> and why you can't switch from one to the other within the MDA's time limit.
>>>>>>>
>>>>>>> Pete


>>>>>>>> On Friday, June 20, 2008 7:01 AM Sanjay Verma wrote:

>>>>>>>> See the following article to find the solution ::
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://harriyott.com/2006/05/contextswitchdeadlock-was-det...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=271410&am...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hope it helps.