How to find and reproduce bugs in multi thread applications – CHESS is to tool you must use!!!

יום רביעי, נובמבר 11, 2009

Hi All, If you want to test and reproduce multi thread applications bugs there is a new tool from Microsft called: CHESS. CHESS is a tool for finding and reproducing Heisenbugs in concurrent programs. CHESS repeatedly runs a concurrent test ensuring that every run takes a different interleaving. If an interleaving results in an error, CHESS can reproduce the interleaving for improved debugging. CHESS is available for both managed and native programs. Great movie that explain CHESS: An Automated Concurrency Testing Tool You must adopt this tool for your future multi threaded (concurrent programs) programs. More information on Threading in C# can be found...
no comments

Insert and Update pattern for multiple threads application with SQL Server

יום ראשון, מאי 10, 2009

Hi,  Have you ever try to insert a row in to a SQL table if the key does not exist and update a row if a key exists. Well this is very common scenario. Usually you would achieve this goal by writing SQL like: if exists (select * from TestTable where ID = @id) begin     update TestTable set myCount = myCount+1  where ID = @idend elsebegin   insert into TestTable values (@id, 1) end This code will work fine for single threaded applications but will not work for multiple threads application. To solve this issue you need to handle primary key violations and fix up...