-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong result of 'insert into' caused by large string in batches #375
Comments
Note: The error neither occurs with 6.1.0 nor with 6.1.7. |
Workaround: turn off prepared statement pooling ( Note: The JDBC data type of batches number 1, 2, 4, 5 is NVARCHAR(4000) and the data type of batch number 3 is NVARCHAR(max). |
Thanks @jubax for workaround |
Note that I do not know much about the internals of the driver, so we need official confirmation if this is a valid workaround. As this error is pretty severe I would also like to know if we should instead switch back to the last official driver version? |
Hi @jubax . Thanks for raising this issue and providing the repro code. This is a valuable finding! |
Thank you very much for the fast 6.2.1 release and for the efforts for a hotfix! |
Hi @ajlam I have checked out and build pr #393 (I got 4 test errors, might be related to my German system environment). I have set up a test with the original data which triggered the issue in our application. The test was still running when I left the office - which is a good sign, since it failed after half an hour with the 6.2.0 release. Thanks |
This is the current state: The test is still running on my developer laptop. I need to stop it on my laptop, but I will execute the test with 6.2.1 on one of our servers which is supposed to finish within an hour once it has been started. |
With 6.2.1 the test finished within an hour on the server as expected. I replaced the driver aftwards and restarted the test. I may investigate a bit further, but most likely not today. Here is a thread dump:
|
Thanks @thomek for the valuable update. We will be investigating this. We appreciate if you could later provide other updates or scenarios that causes this issue. |
I'm trying to create some short test which is independet of our application and the original data. So, at least this is what I'm observing:
Due to that, numBatchesExecuted is never increased. |
Below is an example to trigger the infinite loop with pr #393 which is similar to the original one. For the moment I cannot spend more time on this issue, thank you for taking care about it! `import java.sql.Connection; public class BatchesWithLargeStringTest {
}` |
@thomek Thank you so much for providing the repro. we are working on this. |
Thanks @thomek . I updated the pull request that will solve the issue. This way the exception "cannot find prepared statement handle x" will not happen and the application won't hang in the infinite loop. Would appreciate it If you could confirm if this is working. Thanks again for your help with this! |
I just successfully tested the updated pr #393 in our application with the original data. |
@thomek great to hear that! Thanks again for helping us testing this pr 👍 |
Closing this as fixed by pr #393 |
Driver version: 6.2.0
I create a table and insert five rows.
The resulting table in SQL Server contains five rows, but the third row is missing while the fourth row is duplicated.
The table has two columns, int and nvarchar(max), and I insert each row in a separate batch.
The rows look like these:
0,a
1,b
2,ccc...
3,d
4,e
'ccc...' means a string which consists of 4001 characters.
Selecting the rows of the table returns this result:
0,a
1,b
2,ccc...
4,e
4,e
If I create the table with a primary index on the first column, then inserting the rows leads to a primary key violation.
Here is the code to reproduce the issue.
The text was updated successfully, but these errors were encountered: