Skip to content

Commit

Permalink
[ZEPPELIN-6071] Bump pty4j version to 0.12.10-jdk8
Browse files Browse the repository at this point in the history
This PR is reopening #4806 

### What is this PR for?
Previous pty4j dependency version does not support Silicon OSX
So `%sh.terminal` interpreter did not work on Silicon OSX.
To fix this, I bumped pty4j version to 0.12.35

The previous `pty4j` dependency version does not support macOS on Apple Silicon.
As a result, the `%sh.terminal` interpreter did not work on Apple Silicon macOS.
To fix this issue, I have updated the `pty4j` verison to `0.12.35`

### What type of PR is it?
Bug Fix

### What is the Jira issue?
* Open an issue on Jira https://issues.apache.org/jira/browse/ZEPPELIN/6071

### How should this be tested?

- Run `%sh.terminal` interpreter
  - Main focus : Test on a Mac with Apple Silicon to ensure it works correctly.
  - The native files for other OS/architectures have also changed to match the library version downgrade. It would be helpful to verify that it functions properly on these other OS/architectures as well.

### Screenshots (if appropriate)

#### Before

<img width="1498" alt="image" src="https://github.com/user-attachments/assets/2ee6c9f9-7a1c-41d0-831a-900949d2c9bc">

- The interpreter was not working, and these error logs were generated:
```
ERROR [2024-09-01 14:10:18,305] ({Thread-11} PtyHelpers.java[<clinit>]:231) - Cannot load implementation of interface com.pty4j.unix.PtyHelpers$OSFacade
java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/bt/g5zw1jfn36783j9xvwl6pmg80000gn/T/jna-738948474/jna9752198374376500371.tmp
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1854)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)
	at com.sun.jna.Native.<clinit>(Native.java:190)
	at com.pty4j.unix.macosx.OSFacadeImpl.<clinit>(OSFacadeImpl.java:91)
	at com.pty4j.unix.PtyHelpers$1.call(PtyHelpers.java:200)
	at com.pty4j.unix.PtyHelpers$1.call(PtyHelpers.java:196)
	at com.pty4j.util.LazyValue.getValue(LazyValue.java:25)
	at com.pty4j.unix.PtyHelpers.getOsFacade(PtyHelpers.java:244)
	at com.pty4j.unix.PtyHelpers.<clinit>(PtyHelpers.java:228)
	at com.pty4j.unix.Pty.ptyMasterOpen(Pty.java:141)
	at com.pty4j.unix.Pty.openMaster(Pty.java:193)
	at com.pty4j.unix.Pty.<init>(Pty.java:56)
	at com.pty4j.unix.UnixPtyProcess.<init>(UnixPtyProcess.java:83)
	at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:111)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:78)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:49)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.initializeProcess(TerminalService.java:88)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.lambda$onTerminalReady$0(TerminalService.java:62)
	at java.base/java.lang.Thread.run(Thread.java:829)
 INFO [2024-09-01 14:10:18,324] ({Thread-11} ExtractedNative.java[doInit]:127) - Extracted pty4j native in 17 ms
ERROR [2024-09-01 14:10:18,325] ({Thread-11} PtyHelpers.java[<clinit>]:237) - Cannot load native pty executor library
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
	at com.pty4j.unix.NativePtyExecutor.<init>(NativePtyExecutor.java:14)
	at com.pty4j.unix.PtyHelpers$2.call(PtyHelpers.java:222)
	at com.pty4j.unix.PtyHelpers$2.call(PtyHelpers.java:218)
	at com.pty4j.util.LazyValue.getValue(LazyValue.java:25)
	at com.pty4j.unix.PtyHelpers.getPtyExecutor(PtyHelpers.java:254)
	at com.pty4j.unix.PtyHelpers.<clinit>(PtyHelpers.java:234)
	at com.pty4j.unix.Pty.ptyMasterOpen(Pty.java:141)
	at com.pty4j.unix.Pty.openMaster(Pty.java:193)
	at com.pty4j.unix.Pty.<init>(Pty.java:56)
	at com.pty4j.unix.UnixPtyProcess.<init>(UnixPtyProcess.java:83)
	at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:111)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:78)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:49)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.initializeProcess(TerminalService.java:88)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.lambda$onTerminalReady$0(TerminalService.java:62)
	at java.base/java.lang.Thread.run(Thread.java:829)
ERROR [2024-09-01 14:10:18,325] ({Thread-11} TerminalService.java[lambda$onTerminalReady$0]:64) - Cannot load implementation of interface com.pty4j.unix.PtyHelpers$OSFacade
java.lang.RuntimeException: Cannot load implementation of interface com.pty4j.unix.PtyHelpers$OSFacade
	at com.pty4j.unix.PtyHelpers.getOsFacade(PtyHelpers.java:247)
	at com.pty4j.unix.PtyHelpers.getInstance(PtyHelpers.java:262)
	at com.pty4j.unix.Pty.ptyMasterOpen(Pty.java:141)
	at com.pty4j.unix.Pty.openMaster(Pty.java:193)
	at com.pty4j.unix.Pty.<init>(Pty.java:56)
	at com.pty4j.unix.UnixPtyProcess.<init>(UnixPtyProcess.java:83)
	at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:111)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:78)
	at com.pty4j.PtyProcess.exec(PtyProcess.java:49)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.initializeProcess(TerminalService.java:88)
	at org.apache.zeppelin.shell.terminal.service.TerminalService.lambda$onTerminalReady$0(TerminalService.java:62)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/bt/g5zw1jfn36783j9xvwl6pmg80000gn/T/jna-738948474/jna9752198374376500371.tmp
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1854)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)
	at com.sun.jna.Native.<clinit>(Native.java:190)
	at com.pty4j.unix.macosx.OSFacadeImpl.<clinit>(OSFacadeImpl.java:91)
	at com.pty4j.unix.PtyHelpers$1.call(PtyHelpers.java:200)
	at com.pty4j.unix.PtyHelpers$1.call(PtyHelpers.java:196)
	at com.pty4j.util.LazyValue.getValue(LazyValue.java:25)
	at com.pty4j.unix.PtyHelpers.getOsFacade(PtyHelpers.java:244)
	at com.pty4j.unix.PtyHelpers.<clinit>(PtyHelpers.java:228)
	... 10 more
```

#### After

<img width="1500" alt="image" src="https://github.com/user-attachments/assets/8a548b2c-e75b-4c6f-8607-7bbc4ac08159">

- The interpreter is now working as expected, just like any ordinary shell.

### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No


Closes #4822 from tbonelee/update-pty4j.

Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
tbonelee authored Sep 19, 2024
1 parent a985c56 commit 876d1dc
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 523 deletions.
197 changes: 0 additions & 197 deletions shell/HTERM.md

This file was deleted.

135 changes: 0 additions & 135 deletions shell/PTY4J.md

This file was deleted.

2 changes: 1 addition & 1 deletion shell/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<interpreter.name>sh</interpreter.name>

<!--library versions -->
<pty4j.version>0.9.3</pty4j.version>
<pty4j.version>0.12.10-jdk8</pty4j.version>
<jinjava.version>2.4.0</jinjava.version>
<guava.version>32.0.0-jre</guava.version>
</properties>
Expand Down
Loading

0 comments on commit 876d1dc

Please sign in to comment.