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

OS X snprintf() output has been truncated, py embedded server #4200

Open
devinrsmith opened this issue Jul 18, 2023 · 7 comments
Open

OS X snprintf() output has been truncated, py embedded server #4200

devinrsmith opened this issue Jul 18, 2023 · 7 comments
Assignees
Labels
bug Something isn't working python
Milestone

Comments

@devinrsmith
Copy link
Member

@malhotrashivam was getting an error trying to run the python embedded server:

$ python -i thescript.py
...
Assertion failed: (count <= len && "snprintf() output has been truncated"), function LOAD_ERROR, file dispatch.c, line 74.

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

thescript.py:

from deephaven_server import Server

s = Server(jvm_args=["-DAuthHandlers=io.deephaven.auth.AnonymousAuthenticationHandler"])
s.start()

After a lot of debugging, found out the error is happening somewhere in or around io.deephaven.process.SystemInfoOshi#forCurrentProcess for OS X, oshi.hardware.platform.mac.MacComputerSystem. We tried to step through breakpoints to pin it down, but the specifics eluded us. I suspect there is some deep static initialization or memoization logic that is breaking down.

To workaround for now if you run into this, you can set the system property:
process.info.system-info.enabled=false

@devinrsmith devinrsmith added bug Something isn't working python labels Jul 18, 2023
@devinrsmith devinrsmith added this to the Backlog milestone Jul 18, 2023
@devinrsmith devinrsmith self-assigned this Jul 18, 2023
@malhotrashivam
Copy link
Contributor

malhotrashivam commented Jul 18, 2023

This was happening on an M2 mac with

$ sw_vers
ProductName:		macOS
ProductVersion:		13.4.1
ProductVersionExtra:	(c)
BuildVersion:		22F770820d
$ java -version
openjdk version "11.0.19" 2023-04-18 LTS
OpenJDK Runtime Environment Zulu11.64+19-CA (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.64+19-CA (build 11.0.19+7-LTS, mixed mode)
$ python --version
Python 3.8.17

@niloc132
Copy link
Member

niloc132 commented Jan 9, 2024

Hit this again today with @bmingles, the same workaround got us past it.

@alexpeters1208
Copy link
Contributor

I spent most of the last week trying to figure this out. Specifically, I set out to answer the following question:
"Is there any combination of JDK version / JDK ditstribution / Python version for which this problem does not arise?"

Unfortunately, I still do not have a clear answer.

I tried all combinations of Python 3.8 - 3.12, JDK 11, 17, 21, and zulu, oracle, temurin, and openJDK distribution.
These were installed via pyenv and sdkman respectively, except for the openJDK distributions, which were installed via Homebrew. In all of these cases, I got the error described here.

I wrapped all of these tests up into a set of scripts that anyone can run (if you're reading this and are interested in this problem, please try them): https://github.com/alexpeters1208/test-dh-mac.

This seems like a pretty definitive "doesn't work at all", but not so.

@jmao-denver and I spent some time trying to get to the bottom of it, as this error does not crop up for him. I set my Python version and JDK version to be identical to his (3.9 and zulu 17, if I recall), and I still got the error, while he did not. There is a potentially important difference in how I installed my Python and JDK (pyenv and sdkman) vs how he installed his (Homebrew across the board), so I tried homebrew-installed Python 3.10 with homebrew-installed zulu JDK 17. Still, no dice. Our OS versions and XCode versions were different, so I upgraded my OS and Xcode. Nothing changed. I don't exactly recall all of his versions where things were working (@jmao-denver Maybe you could paste all the relevant versioning info here?)

In addition to Jianfeng, @chipkent @elijahpetty @nbauernfeind seem to be able to get the embedded server running on Apple silicon without this error, and without the workaround flag. I got detailed version info from Chip and Elijah, but did not learn much more from this info. There are not obvious version combinations they have that I have not tried.

Jianfeng's last suggestion was to try to upgrade JNA. He is on 5.13, I am on 5.9. However, at least Elijah, Chip, and Nate have JNA 5.9, so I am not sure that this could be a smoking gun. I still have not performed this upgrade test myself.

@jmao-denver
Copy link
Contributor

I have tried the tests in @alexpeters1208 's repo with some minor changes. Most of them passed with a few failures, some of which I tried again manually and all passed.

@alexpeters1208
Copy link
Contributor

I have tried the tests in @alexpeters1208 's repo with some minor changes. Most of them passed with a few failures, some of which I tried again manually and all passed.

This seems to be strong evidence suggesting that this problem is independent of. JDK distro / JDK version / Python version.

@nbauernfeind
Copy link
Member

Just to add to the conversation here. This is the environment that does work without disabling process info for me.

Processor: Apple M2 Max
macOS: Sonoma 14.5

Python 3.12.3 (v3.12.3:f6650f9ad7, Apr 9 2024, 08:18:47) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin

openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment Homebrew (build 21.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.2, mixed mode, sharing)

I'd like to note that the Temurin (jdk-11 at least, maybe all of them) does not work on linux. It fails trying to class-load io.deephaven.gui.color.Color.

@bmingles
Copy link
Contributor

I got this error on an M1 when using pyenv targetting 3.12.0 + some other versions. I did not get the issue when using my homebrew install of 3.12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python
Projects
None yet
Development

No branches or pull requests

7 participants