-
Notifications
You must be signed in to change notification settings - Fork 255
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
Crashes on Apple M1 #667
Comments
I see same exact crash using |
Does it only occur on Java 20? Can you try older Java? |
i was also thinking the same. i am not able to try older java but there is
very similar issue filed for jpype by someone else that uses JDK 17:
jpype-project/jpype#1143
…On Wed, Aug 30, 2023 at 2:48 AM Craig Macdonald ***@***.***> wrote:
Does it only occur on Java 20? Can you try older Java?
—
Reply to this email directly, view it on GitHub
<#667 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEK3EZTAEQQNQYLVIAD3XX4D77ANCNFSM6AAAAAA4DTWRFI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
We've not been able to reproduce this on new apple silicon tests under #679. Some google suggests that the error goes away if macOS is upgraded (Homebrew/homebrew-core#124306)? |
As @cmacdonald said, we're not able to reproduce the issue on latest |
for me its a repro:
I am on Mac OS 13.5.2 (22G91) (Ventura) |
anything useful in the hs_err_pid10269.log file? |
https://stackoverflow.com/questions/75496223/macos-13-3-beta-killed-java talks about brew JDKs vs Oracle. Silly question - does Java work normally on this machine (i.e. can you try some Java programs, jshell etc), so that we can establish if the problem is Java or Jnius? |
Yes Java works normally on the machine. |
log has been pasted earlier in the thread |
ok, I have a theory based on random searches that this somehow relates to MAP_JIT security that is enabled on Apple Silicon. Assuming you have clang installed, could you try to compile and execute the attached C++ code: This compilation should work
On my Intel mac, executing the ./a.out binary, it gives the following output:
If yours gives the SIGBUS error, could you uncomment line 22 and try again, i.e. enabling |
(Not sure the above is going to work) Could you paste the XML output of |
On the Github Action runner for apple-silicon, Python is signed and has some security features disabled (see below)
My bet is your Python does not have this. |
|
I think the problem here is that your Python does not include python/cpython#84379 and https://bugs.python.org/issue43964 suggests that the correct entitlements have been present since Python 3.7.7 and 3.8.2. On my (Intel) macOS 13.5.1, /usr/bin/python3 is version 3.7.6 and has no entitlements. Could you try installing a more recent version of Python and verify it has the relevant entitlements? |
AND, to verify that we can identify such a problem, could you try to install the Pyjnius version in #698 on the original non-working Python: i.e. pip install git+https://github.com/cmacdonald/pyjnius.git@issue_667 should fail to install on your /Users/xxx/code/venv/myenv/bin/python3 |
Hi Craig, thanks for investigating this issue but I don't think entitlements is the cause of the problem. I am not an expert but here are the reasons I think so:
this is what my best friend had to say: A SIGBUS error is a signal in Unix and Unix-like operating systems (including Linux and macOS) that indicates a bus error. This error occurs when the program tries to perform an unaligned memory access at the hardware level, specifically referring to accessing memory on a computer's bus. Here are a few common causes of a SIGBUS error: Unaligned memory access: Some architectures, especially older ones, require data to be aligned in memory. If a program attempts to access memory in a way that violates alignment requirements, it can result in a SIGBUS error. Hardware failure: In rare cases, a SIGBUS error might be an indication of a hardware problem, such as issues with the computer's memory or other low-level components. Operating system issues: Bugs or errors in the operating system's kernel or low-level libraries could also lead to SIGBUS errors. When a program encounters a SIGBUS error, it typically terminates and produces a core dump, which is a file containing a snapshot of the program's memory at the time of the crash. Analyzing the core dump can help developers diagnose and fix the issue. If you encounter a SIGBUS error, it's important to review your code for potential memory access issues, such as unaligned data access. Additionally, checking for hardware issues and ensuring that your software is compatible with the architecture and platform it's running on can be helpful in resolving SIGBUS errors. |
also I am confused about how this whole thing works. does python call C++ code (using ctypes) and the C++ code then call Java (using JNI)? could you explain? |
Entitlements are only activated for Apple Silicon. I have an intel.
Similarly, again entitlements are only activated on Apple Silicon (where this cannot find library error was detected). That version of Python was another error where there was missing entitlements.
SIGBUS is mentioned in unicorn-engine/unicorn#1470 about jit_write, MAP_JIT etc. I wont comment on the genericity of ChatGPT. I suggested a method of working around the problem - given how late I worked on it last night, I'd appreciate if you can attempt it. |
@siddhsql any news on using a more recent version of Python? |
I will have to hold off on it for a bit. I think you might be correct in your diagnosis:
Should I use |
Can you try installing 3.11.5 from:
Entitlements are held by the executable binary. You already showed that the Java executable has entitlements; Python does not. Entitlements are needed by the JVM (its a JIT compiler), so when the JVM is initialised from the Python binary these entitlements are missing, therefore causing the SIGBUS. |
okay I will try and update the thread with my findings but it might be a while. |
Any news @siddhsql? |
Hi Craig, unfortunately I won't be able to get back anytime soon. I am
parking this issue for later.
…On Fri, Nov 24, 2023 at 3:29 AM Craig Macdonald ***@***.***> wrote:
Any news @siddhsql <https://github.com/siddhsql>?
—
Reply to this email directly, view it on GitHub
<#667 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEK5T32FTJ4A2MXETNSLYGCAIJAVCNFSM6AAAAAA4DTWRFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGUZTOOBVG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
An update from my side: I now have access to an Apple M1 mac. I can confirm that the Apple provided Python ( |
Closing as not planned. |
https://gist.github.com/siddhsql/272b81c8f02d00c341cf934d5d11f6c1
The text was updated successfully, but these errors were encountered: