Red Gate forums :: View topic - Threading issue
Return to RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Toolkit Previous Versions
SQL Toolkit Previous Versions forum

Threading issue

Search in SQL Toolkit Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message

Joined: 15 Oct 2007
Posts: 3

PostPosted: Mon Oct 15, 2007 10:50 pm    Post subject: Threading issue Reply with quote

I've written a custom program to synchronize the database schema changes for all of our production databases. When I modified it run a each synchronization task in a separate thread, it occasionally throws a NullReferenceException:

Here is an example of a stack trace:

10/13/2007 09:30:11.7 , CRIT , Object reference not set to an instance of an object.
10/13/2007 09:30:11.7 , CRIT , RedGate.SQLCompare.Engine
10/13/2007 09:30:11.7 , CRIT , at antlr.ASTFactory.addASTChild(ASTPair currentAST, AST child)
at _14._12()
at _14._11()
at _14._9()
at _14._27()
at _14._26()
at _14._25()
at _14._5()
at _14._2()
at _26._2(String , String , Options )
at RedGate.SQLCompare.Engine.Default._1(String , String , Options )
at RedGate.SQLCompare.Engine.Field._1(Field , Options , SqlCompareOwnerMappings , Boolean , Database )
at RedGate.SQLCompare.Engine.Table.Equals(IDatabaseObject targetObject, Options options, SqlCompareOwnerMappings mappings, Boolean runOnTwo, Database masterDatabase)
at RedGate.SQLCompare.Engine.Database._1(Differences , IDatabaseObjects , IDatabaseObjects , Options , Int32 , Int64 , Int64& , Int32& , SqlCompareOwnerMappings )
at RedGate.SQLCompare.Engine.Database.CompareWith(Database targetDatabase, Options options, SqlCompareOwnerMappings mappings)
at RedGate.SQLCompare.Engine.Database.CompareWith(Database targetDatabase, Options options)
at UpdateManager.LoadDifferences()

The stack trace is not always identical, but it is similar.

These are the dlls I'm using:


Are these libraries guaranteed to be thread-safe? Is this a bug?
Back to top
View user's profile Send private message
Brian Donahue

Joined: 23 Aug 2004
Posts: 6678

PostPosted: Wed Oct 24, 2007 3:16 pm    Post subject: Reply with quote


The SQL Compare Engine is not marked as thread-safe, therefore it should be assumed that it is not. Particularly, using a single Database object from multiple threads can cause problems, as there is some state information maintained in the Database object.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group