jpy-consortium / jpy

Apache License 2.0
71 stars 17 forks source link

get_type ordering crash #142

Closed devinrsmith closed 4 months ago

devinrsmith commented 5 months ago

In some cases, it seems like jpy.get_type will cause crashes and SIGSEGVs. During the development of https://github.com/deephaven/deephaven-core/pull/5225, I noticed that the following crashes:

import jpy

jpy.get_type("io.deephaven.json.ArrayOptions")

, but works if we import the base class first:

import jpy

jpy.get_type("io.deephaven.json.ValueOptions")
jpy.get_type("io.deephaven.json.ArrayOptions")

The error looks something like

2024-04-10T22:59:04.700Z | r-Scheduler-Serial-1 |  INFO | .p.PythonDeephavenSession | Evaluating command: import jpy
2024-04-10T22:59:06.225Z | r-Scheduler-Serial-1 |  INFO | .p.PythonDeephavenSession | Evaluating command: jpy.get_type("io.deephaven.json.ArrayOptions")
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fc317a0f9e9, pid=85835, tid=86053
#
# JRE version: OpenJDK Runtime Environment Zulu21.32+17-CA (21.0.2+13) (build 21.0.2+13-LTS)
# Java VM: OpenJDK 64-Bit Server VM Zulu21.32+17-CA (21.0.2+13-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libpython3.12.so+0x20f9e9]
...

I assumed there might have been an issues with some static initializers, but I couldn't find anything. Via groovy, importing ArrayOptions first seems to work out just fine.

jmao-denver commented 5 months ago

Could be related to https://github.com/deephaven/deephaven-core/issues/4072