Using SqlBulkCopy in a multithread scenario with ThreadPool issue

Posted by Ruben F. on Stack Overflow See other posts from Stack Overflow or by Ruben F.
Published on 2010-04-06T17:33:22Z Indexed on 2010/04/06 17:43 UTC
Read the original article Hit count: 520

Filed under:
|
|
|

Hi.

I'm facing a dilemma (!).

In a first scenario, i implemented a solution that replicates data from one data base to another using SQLBulkCopy synchronously and i had no problem at all.

Now, using ThreadPool, i implemented the same in a assynchronously scenario, a thread per table, and all works fine, but past some time (usualy 1hour because the operations of copy takes about the same time), the operations sended to the ThreadPool stop being executed. There are one diferent SQLBulkCopy using one diferent SQLConnection per thread.

I already see the number of free threads, and they are all free at the begining of the invocation...I have one AutoResetEvent to wait that the threads finish their job before launching again, and a Semaphore FIFO that hold the counter of active threads.

There are some issue that I have forgotten or that I should avaliate when using SqlBulkCopy? I apreciate some help, because my ideas are over;)

Thanks

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#