Skip to content
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

SNOW-1423466: Snowflake JDBC driver not working with Spring Boot 3.2.0 (Throws NegativeArraySizeException) #1755

Closed
dsinghal-nice opened this issue May 15, 2024 · 6 comments
Assignees
Labels
duplicate status-triage_done Initial triage done, will be further handled by the driver team

Comments

@dsinghal-nice
Copy link

dsinghal-nice commented May 15, 2024

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of JDBC driver are you using?
    Starting from 3.14.0, this issue is coming

  2. What operating system and processor architecture are you using?
    Windows 11

  3. What version of Java are you using?
    Java 17

  4. What did you do?

    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

    I recently upgraded my project from Spring boot 2 to Spring boot 3, this exception started to come after that.

  5. What did you expect to see?

    What should have happened and what happened instead?

    My application should have started without any issue, but failing to even load at boot. Below is the exception:

Exception in thread "main" java.lang.NegativeArraySizeException: -31736
	at org.springframework.boot.loader.zip.ZipContent$Loader.<init>(ZipContent.java:435)
	at org.springframework.boot.loader.zip.ZipContent$Loader.loadContent(ZipContent.java:565)
	at org.springframework.boot.loader.zip.ZipContent$Loader.openAndLoad(ZipContent.java:543)
	at org.springframework.boot.loader.zip.ZipContent$Loader.loadNestedZip(ZipContent.java:537)
	at org.springframework.boot.loader.zip.ZipContent$Loader.load(ZipContent.java:522)
	at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:372)
	at org.springframework.boot.loader.zip.ZipContent.open(ZipContent.java:361)
	at org.springframework.boot.loader.jar.NestedJarFileResources.<init>(NestedJarFileResources.java:57)
	at org.springframework.boot.loader.jar.NestedJarFile.<init>(NestedJarFile.java:141)
	at org.springframework.boot.loader.jar.NestedJarFile.<init>(NestedJarFile.java:120)
	at org.springframework.boot.loader.net.protocol.jar.UrlNestedJarFile.<init>(UrlNestedJarFile.java:42)
	at org.springframework.boot.loader.net.protocol.jar.UrlJarFileFactory.createJarFileForNested(UrlJarFileFactory.java:86)
	at org.springframework.boot.loader.net.protocol.jar.UrlJarFileFactory.createJarFile(UrlJarFileFactory.java:55)
	at org.springframework.boot.loader.net.protocol.jar.UrlJarFiles.getOrCreate(UrlJarFiles.java:72)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.connect(JarUrlConnection.java:289)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlConnection.getJarFile(JarUrlConnection.java:99)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.getJarFile(JarUrlClassLoader.java:185)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackage(JarUrlClassLoader.java:143)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.definePackageIfNecessary(JarUrlClassLoader.java:126)
	at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:99)
	at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:88)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
	at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
  1. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

    The application doesn't even load the class files at the startup, it fails when Spring Boot 3 tried to load class so debug logs gets created. The same upgrade is working 3.13.34 but giving me another error Illegal char <:> at index 6:sf_client_config.json

  2. What is your Snowflake account identifier, if any? (Optional)

@github-actions github-actions bot changed the title Snowflake JDBC driver not working with Spring Boot 3.2.0 SNOW-1423466: Snowflake JDBC driver not working with Spring Boot 3.2.0 May 15, 2024
@dsinghal-nice dsinghal-nice changed the title SNOW-1423466: Snowflake JDBC driver not working with Spring Boot 3.2.0 SNOW-1423466: Snowflake JDBC driver not working with Spring Boot 3.2.0 (Throws NegativeArraySizeException) May 15, 2024
@sfc-gh-wfateem sfc-gh-wfateem self-assigned this May 15, 2024
@sfc-gh-wfateem sfc-gh-wfateem added the status-triage Issue is under initial triage label May 15, 2024
@sfc-gh-wfateem
Copy link
Collaborator

@dsinghal-nice I'm not sure this is necessarily a JDBC driver issue. That exception you're sharing looks like an issue with Spring boot's code when it's trying to unpack the JARs on the classpath looking for a class to load:

Exception in thread "main" java.lang.NegativeArraySizeException: -31736
	at org.springframework.boot.loader.zip.ZipContent$Loader.<init>(ZipContent.java:435)
	at org.springframework.boot.loader.zip.ZipContent$Loader.loadContent(ZipContent.java:565)
	at org.springframework.boot.loader.zip.ZipContent$Loader.openAndLoad(ZipContent.java:543)

I did a quick search in their project and I see the following issue which seems to be the problem you're running into:
spring-projects/spring-boot#38572

Can you refer to the conversation there and see if there's anything in there that can help you address the problem? If not, then I would suggest you first raise this issue with the Spring Boot team. If they need any information or they suspect there's a problem with our JAR, then just let us know and we'll take a look.

@sfc-gh-wfateem sfc-gh-wfateem added status-triage_done Initial triage done, will be further handled by the driver team status-information_needed Additional information is required from the reporter invalid and removed status-triage Issue is under initial triage bug labels May 15, 2024
@dsinghal-nice
Copy link
Author

Hi @sfc-gh-wfateem,

The snowflake-jdbc version (3.14.1) with Spring Boot 3.2.0 has this issue, and with Spring Boot 3.2.5 it is throwing another exception:

ERROR c.n.s.w.q.a.ser.utils.SnowflakeCommonUtils [] [] [] [] [] Error connecting to Snowflake:
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Illegal char <:> at index 6: nested:\C:\Deepak\CXBI\workspace\ms-cxcv-query-engine\impl\target\cxcv-query-engine-impl-1.0.0-SNAPSHOT.jar!BOOT-INF\lib\sf_client_config.json
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:100)
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:81)

@sfc-gh-wfateem
Copy link
Collaborator

@dsinghal-nice Do you know what you have in this file?
C:\Deepak\CXBI\workspace\ms-cxcv-query-engine\impl\target\cxcv-query-engine-impl-1.0.0-SNAPSHOT.jar!BOOT-INF\lib\sf_client_config.json

@dsinghal-nice
Copy link
Author

dsinghal-nice commented May 21, 2024

@sfc-gh-wfateem, I checked the .jar, this file doesn't even exist at the location.

With version 3.13.30 this error does not come when I use Spring Boot 3.2.5. With version above 3.13.30 it starts to come.

This looks like the same issue mentioned here:
#1651 (comment)

@sfc-gh-dszmolka
Copy link
Contributor

PR in progress at #1763, and I would suggest marking this as duplicate of #1651 and closing

@dsinghal-nice
Copy link
Author

Thanks !! @sfc-gh-dszmolka

@sfc-gh-dszmolka sfc-gh-dszmolka added duplicate and removed invalid status-information_needed Additional information is required from the reporter labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

3 participants