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

JVM Crash when using a specific jar : cloudera HS2Driver (Hive), any versions #1137

Open
TheCodingLand opened this issue Jun 15, 2023 · 2 comments

Comments

@TheCodingLand
Copy link

TheCodingLand commented Jun 15, 2023

I try to use the cloudera Hive driver with Jpype, but the JVM encouters a fatal error.

here is some code to reproduce the error.

from jpype import startJVM, shutdownJVM 
import jpype.imports
from jpype.types import * # pyright: ignore
from pathlib import Path
driver ="com.cloudera.hive.jdbc.HS2Driver"
jdbc_url= "jdbc:hive2://test.com:443/db" # any valid dns url

JVM_PATH = "jdk-20.0.1\\bin\\server\\jvm.dll"

hive_jar = Path(__file__).parent/ 'jar' / 'HiveJDBC42.jar'

startJVM(JVM_PATH, classpath=[str(hive_jar)])

from java.sql import DriverManager

conn_db = DriverManager.getConnection(jdbc_url, "username", "password")
conn_db.close()

The jar file itself can be obtained here

Tested with many versions and different JDK versions as well.

You don't need a Hive environment to reproduce.

conda env used:

name: jvm_test_jpype
channels:
  - conda-forge
dependencies:
  - bzip2=1.0.8
  - ca-certificates=2023.5.7
  - jaydebeapi=1.2.3
  - jpype1=1.4.1
  - libexpat=2.5.0
  - libffi=3.4.2
  - libsqlite=3.42.0
  - libzlib=1.2.13
  - openssl=3.1.1
  - packaging=23.1
  - pip=23.1.2
  - python=3.11.4
  - python_abi=3.11
  - setuptools=67.7.2
  - tk=8.6.12
  - tzdata=2023c
  - wheel=0.40.0
  

hs_err:

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x00007ff94901051c, pid=26732, tid=13640
#
# JRE version: Java(TM) SE Runtime Environment (20.0.1+9) (build 20.0.1+9-29)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0.1+9-29, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  [KERNELBASE.dll+0x9051c]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: 

Host: 13th Gen Intel(R) Core(TM) i9-13900KF, 32 cores, 63G,  Windows 11 , 64 bit Build 22621 (10.0.22621.1194)
Time: Thu Jun 15 15:28:10 2023 Paris, Madrid (heure d��t�) elapsed time: 21.452113 seconds (0d 0h 0m 21s)

---------------  T H R E A D  ---------------

Current thread (0x00000261c53737e0):  JavaThread "main" [_thread_in_native, id=13640, stack(0x000000917f600000,0x000000917f7f0000)]

Stack: [0x000000917f600000,0x000000917f7f0000],  sp=0x000000917f7dfb00,  free space=1918k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [KERNELBASE.dll+0x9051c]
C  [VCRUNTIME140.dll+0x6720]
C  [_jpype.cp311-win_amd64.pyd+0x3bca7]
C  [_jpype.cp311-win_amd64.pyd+0x2affb]
C  0x00000261d6361ff3

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.jpype.manager.TypeFactoryNative.newWrapper(JJ)V+0
j  org.jpype.JPypeContext.newWrapper(J)V+16
v  ~StubRoutines::call_stub 0x00000261d634100d

siginfo: EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363), ExceptionInformation=0x0000000019930520 0x000000917f7dfce0 0x00007ff842616d78 0x00007ff8425b0000 ...

@Thrameos
Copy link
Contributor

Interesting. Not sure what could be going on there. It looks like it trying to make a new wrapper class and something sent from Java was bogus.

@TheCodingLand
Copy link
Author

TheCodingLand commented Jul 19, 2023

Interesting, looks like I have a lot more issues with jpype under windows than linux.
I tested the same code in a container and it doesnt fail.
I'd be glad to know if anyone has any tips on why this could be happening. (stubgenj is also crashing when trying to generate stubs with a lot of different jars, but it works on linux.)
For example, I had an issue generating stubs for liquibase under windows, but it worked under linux, Looks like the same root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants