Home All Groups Group Topic Archive Search About
Author
25 Apr 2006 4:21 PM
OldButStillLearning
Hello, I am getting this "ContextSwitchDeadlock" error message pop up in
situations where I am doing a Data Reader loop, where I am processing about
40,000 records.  For each record read via the data reader, I am creating
another data reader to read another database table (can't join these tables -
on different machines) to get additional information.  I am guessing that I
am getting this error message becuase the loop is taking longer the 60
seconds to complete.  Here is what is said about the error
"The most probable cause is that a single-threaded apartment (STA) thread is
not pumping messages. The STA thread is either waiting without pumping
messages or is performing lengthy operations and is not allowing the message
queue to pump."

I'm sorry, but I do not have a clue as to what this means.  The other
probable cause is a process is consuming too much memory.  Not sure That this
would apply to me but perhaps opening and closing 40,000 data readers is
sucking up memory, although I would have expected the garbage collector to
have released this memory, but perhpas because it is all within the same
paragraph, the memory is not being release.  I often just cancel out of the
error message and continue with the process and it completes successfully, so
I don't think it is a memory issue.
If I do not run in debug mode, I get the same error message running in
"Release" mode.

I read that you can turn off the MDA errors via the config file, but this
does not seem to me to be the appropriate solution to the problem... Does it?

Any ideas or suggestions?

Thanks in advance for your assistance!!!!

Author
25 Apr 2006 8:11 PM
William (Bill) Vaughn
Have you tried to access the two data sources with a Linked Server approach
that lets SQL Server do all of the processing?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"OldButStillLearning" <OldButStillLearn***@discussions.microsoft.com> wrote
in message news:E2D8FB44-DA7A-4629-80BE-C804D86D8F08@microsoft.com...
> Hello, I am getting this "ContextSwitchDeadlock" error message pop up in
> situations where I am doing a Data Reader loop, where I am processing
> about
> 40,000 records.  For each record read via the data reader, I am creating
> another data reader to read another database table (can't join these
> tables -
> on different machines) to get additional information.  I am guessing that
> I
> am getting this error message becuase the loop is taking longer the 60
> seconds to complete.  Here is what is said about the error
> "The most probable cause is that a single-threaded apartment (STA) thread
> is
> not pumping messages. The STA thread is either waiting without pumping
> messages or is performing lengthy operations and is not allowing the
> message
> queue to pump."
>
> I'm sorry, but I do not have a clue as to what this means.  The other
> probable cause is a process is consuming too much memory.  Not sure That
> this
> would apply to me but perhaps opening and closing 40,000 data readers is
> sucking up memory, although I would have expected the garbage collector to
> have released this memory, but perhpas because it is all within the same
> paragraph, the memory is not being release.  I often just cancel out of
> the
> error message and continue with the process and it completes successfully,
> so
> I don't think it is a memory issue.
> If I do not run in debug mode, I get the same error message running in
> "Release" mode.
>
> I read that you can turn off the MDA errors via the config file, but this
> does not seem to me to be the appropriate solution to the problem... Does
> it?
>
> Any ideas or suggestions?
>
> Thanks in advance for your assistance!!!!
Author
25 Apr 2006 10:11 PM
OldButStillLearning
Thanks Bill, but unfortuneately my database is an Oracle database and not
SQL.  I suppose that I could introduce SQL into the equation, but I think
that overly complicates things.  But, even if I did this, my guess would be I
would get the same error if I called a SQL stored procedure, it sounds to me
that I would still get the same error, as it would take longer then 60
seconds to complete.

By the way, I attending your presentation in KC for the .net user group. 
You were great!!  Thanks for coming and sharing with us!!!
Author
25 Apr 2006 11:09 PM
William (Bill) Vaughn
You would not be the first to bring  SQL Server (even the Free Express
Edition) to a site to get a choice set of features.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"OldButStillLearning" <OldButStillLearn***@discussions.microsoft.com> wrote
in message news:CDD8F92A-D260-4F1C-BD1F-E4083EE6C223@microsoft.com...
> Thanks Bill, but unfortuneately my database is an Oracle database and not
> SQL.  I suppose that I could introduce SQL into the equation, but I think
> that overly complicates things.  But, even if I did this, my guess would
> be I
> would get the same error if I called a SQL stored procedure, it sounds to
> me
> that I would still get the same error, as it would take longer then 60
> seconds to complete.
>
> By the way, I attending your presentation in KC for the .net user group.
> You were great!!  Thanks for coming and sharing with us!!!
Author
25 Apr 2006 11:09 PM
William (Bill) Vaughn
And I'm glad you liked the talk. It was a nice break from my MIL.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"OldButStillLearning" <OldButStillLearn***@discussions.microsoft.com> wrote
in message news:CDD8F92A-D260-4F1C-BD1F-E4083EE6C223@microsoft.com...
> Thanks Bill, but unfortuneately my database is an Oracle database and not
> SQL.  I suppose that I could introduce SQL into the equation, but I think
> that overly complicates things.  But, even if I did this, my guess would
> be I
> would get the same error if I called a SQL stored procedure, it sounds to
> me
> that I would still get the same error, as it would take longer then 60
> seconds to complete.
>
> By the way, I attending your presentation in KC for the .net user group.
> You were great!!  Thanks for coming and sharing with us!!!

AddThis Social Bookmark Button