1
Vote

IndexOutOfRangeException when moving large amounts of data

description

Hi,

We are using SQL Server 2012 with version 4.0.15. Very often when we copy somewhat large (biggest tables containing 1 to 10 million rows) databases to Azure, tool crashes with IndexOutOfRangeException, originating apparently from BCPCommandCtrl.cs, method StringBuilder.ToString(). Usually this seems to happen when exactly 500 000 rows of a large table have been copied.

We figured this might have something to do with StringBuilder methods not being thread safe. Using lock statement to set lines using StringBuilder as critical sections seemed indeed to fix the problem (see attached patch).

Is this a known error, and do you think this is the right way to go about fixing it?

Cheers,
John

file attachments

comments

ghuey wrote Sep 26, 2013 at 2:41 PM

Hi John,

Yes, this is a problem that others have seen before and that I have never been able to reproduce on my machine. And I have loaded tables with well over 200,000,000 rows. Anyway, THANKS SO MUCH for sending me the patch. I will add it and test and update. I will let you know when I deploy.

Thanks again, I will get right on this.

Regards,
George

ghuey wrote Sep 27, 2013 at 12:36 AM

Hi John,

I made the changes and moved a couple 5 million row tables for test and everything looks good. Check out v3.9.13 and v4.0.16. Please let me know if you have any issues and please feel free to send me any patches :-).

Thanks!!!
George

jarete wrote Sep 27, 2013 at 8:40 AM

That's great news!

Thank you for such a quick response and thanks a lot for the great tool!

Cheers,
John