Pete's Windows, Office, VB & SQL Blog

Problems I have solved (or not) and good ideas I've found

Posts Tagged ‘Environment

Internal connection fatal error.

leave a comment »

A small upgrade to fix a relatively minor problem and suddenly my SQL call result in “Internal connection fatal error.”.  Google, for once doesn’t give an immediate solution.  Too many people get too technical too quickly.  I examined the program carefully to ensure that the queries and updates are all using the correct connections.  This is a multi-threaded, multi-connection application.  There were minor errors.  I fixed them.  I couldn’t understand why I couldn’t reproduce the errors on my own workstation.  It has to be environmental.

Then I came across this. Thanks to Bob whose comment at the end sent me on the MDAC track.

Microsoft provide a nice utility to check the versions of MDAC. It reveals that I have generated and tested the program in a MDAC 2.81.1132 (from XP Sp3) environment, and am running it in a MDAC 2.81.1117 (from XP SP2) environment.  Never clever!

I set up a test environment with the correct version of MDAC – no change, the problem still occurs.  I examined my trace.  The problem always occurs after two threads have processed and their trace entries are intermingled.  If the dispose of one connection occurs while the connection to the other thread is active – Bang!

Much more careful program searching found that the connection that is failing is established on the secondary thread and passed to the primary via an ‘invoke’.  I’ve not found anything that says I shouldn’t do this, but it was the only one and always the one that failed.

Having now changed the code to ensure that connections are not used across a thread the program is functioning correctly and has been stable for over a week.

Written by fisherpeter

2010 May 1 at 09:28

Follow

Get every new post delivered to your Inbox.