dmory
Joined: 15 Oct 2007 Posts: 3
|
Posted: Mon Oct 15, 2007 10:50 pm Post subject: Threading issue |
|
|
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:
RedGate.SQL.Shared 5.3.0.2
RedGate.SQLCompare.Engine 5.3.0.44
Are these libraries guaranteed to be thread-safe? Is this a bug? |
|
Brian Donahue
Joined: 23 Aug 2004 Posts: 6369 Location: Red Gate Software
|
Posted: Wed Oct 24, 2007 3:16 pm Post subject: |
|
|
Hi,
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. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|