Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Segmentation fault (core dumped) when instantiating the JavaClass #70

Open
Sandro-Meireles opened this issue Mar 26, 2022 · 1 comment

Comments

@Sandro-Meireles
Copy link

Sandro-Meireles commented Mar 26, 2022

Describe the bug
I'm not able to instantiate the JavaClass. Segmentation fault (core dumped)

To Reproduce
Steps to reproduce the behavior:

  1. Cloned the repository;
  2. Installed the package locally
  3. Ran make
  4. Had to set librubicon.so in RUBICON_LIBRARY environment variable
  5. When I entered the python shell and tried to instantiate the rubicon.java.JavaClass the error happened

Screenshots
image
image

Environment:

  • Operating System: Ubuntu 20.04.2 LTS
  • Python version: 3.8.10

Additional context
I didn't try to install the Briefcase or Toga yet

@freakboy3742
Copy link
Member

This isn't a bug - it's a feature that isn't currently implemented.

There are two ways to approach the sort of bridge that Rubicon-Java provides:

  1. Embed Python in to the Java Virtual Machine.

  2. Embed a Java Virtual Machine into a running Python process.

Rubicon Java currently implements (1), as this is the mode that is required to implement Android applications. When you run the test suite, it starts a Java app (org.beeware.rubicon.test.Test), which starts a Python VM and runs the unitest suite as Python code.

AFAIK, there's nothing that fundamentally prevents (2) from being implement - it's just a mode of operation that isn't currently supported. It should be relatively straightforward to implement - add a wrapped entry point that instantiates a Java VM (using JNI_CreateJavaVM()) and ensures that the Python method invocation handler is installed. In fact, it would make running the test suite easier, as we would be able to use all the features of Python's test tooling, rather than just the features that are proxied through the Java test wrapper. However, it's not currently a high priority as (a) we have a working test suite, and (b) the 'embedded python' approach is our primary use case.

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

No branches or pull requests

2 participants