-
Notifications
You must be signed in to change notification settings - Fork 427
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
Driver throws ArrayIndexOutOfBoundsException from internal code #2222
Comments
Hi @qingwei91, We'll look into this. While we're doing so, do you have repro code to reproduce the issue? |
Hi @Jeffery-Wasty , I will try to make one From what I observe, it happens when we have BigDecimal in Table Value Param, and its scale or precision are too large, I havent found the exact value though |
Regarding |
Hi @Jeffery-Wasty , thanks for the tip, it however does not fix my issue. My colleague says that he seen this before and was managed to fix it by forcing scale to a lower number, I will try that out, and see if I can find a way to trigger it. |
Hi, I manage to reproduce this by setting scale of BigDecimal to 40, so looks like there's some assumption around how big the number can, if that's indeed by design it would be nicer to throw a more friendly error if possible I will try to create a minimal reprod, but it might take a while. |
Max |
Hi @Jeffery-Wasty , so 38 precision is indeed the maximum the problematic code can handle The I believe SQL Server cant handle precision larger than 38, I guess that's where the hardcoded 17 bytes come from, the library should probably do some checking at a higher level, I am using SQLSErverDataTable, this region might be relevant: https://github.com/microsoft/mssql-jdbc/blob/main/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java#L232-L236 |
Our thoughts as well, this should have been caught earlier up, to enforce the 38 limit. We'll make those changes when we can and leave this issue open until we do. |
Hi @qingwei91, I'm still interested in whether you're able to provide a repro for this. When I try to create a table with |
Hi @Jeffery-Wasty , can you try this? https://github.com/qingwei91/mssql-debug the readme contains the db setup (with docker) The main code will reproduce the problem, it is a scala project using sbt to build, you can run by |
Driver version
SQL Server version
Microsoft SQL Server 2019 (RTM-CU16) (KB5011644) - 15.0.4223.1 (X64)
Client Operating System
Linux (Redhat)
JAVA/JVM version
JDK 11
Table schema
Irrelevant
Problem description
When trying to call a stored procedure that uses Table Valued Parameters, the driver throws exception with the following stack trace.
I was able to write less rows using the same code, but I cant pinpoint if the problem is due to data size, this happens when I was passing 100k++ rows using table valued params.
If there's something wrong with the input data, I expect driver to report something that's more actionable
Expected behavior
It should either not throw or provide clearer error message if there's indeed a user error.
Actual behavior
I get error from System.arraycopy, coming deep inside the driver.
Error message/stack trace
Any other details that can be helpful
Add any other context about the problem here.
JDBC trace logs
The text was updated successfully, but these errors were encountered: