dragonwell-project / dragonwell11

Alibaba Dragonwell11 JDK
https://www.aliyun.com/product/dragonwell
GNU General Public License v2.0
557 stars 113 forks source link

[Wisp2] Failure with Unix socket from junixsocket #531

Open LXY1226 opened 1 year ago

LXY1226 commented 1 year ago

Description Wanna to get a unix socket program work with wisp2 and found it says like:

java.lang.UnsupportedOperationException
       java.base/java.net.Socket.<init>(Socket.java:207)
       org.newsclub.net.unix.AFSocket.<init>(AFSocket.java:70)

Steps to Reproduce Steps to reproduce the behavior:

  1. download a test jar here
  2. run it like ./dragonwell-11.0.18.14+9-GA/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseWisp2 -jar junixsocket-selftest-2.6.2-jar-with-dependencies.jar
  3. wait it boom

Expected behavior All tests passed like it without -XX:+UseWisp2

JDK version

openjdk 11.0.18.14 2023-01-17
OpenJDK Runtime Environment (Alibaba Dragonwell Extended Edition)-11.0.18.14+9-GA (build 11.0.18.14+9)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell Extended Edition)-11.0.18.14+9-GA (build 11.0.18.14+9, mixed mode)

Execution environment

This program determines whether junixsocket is supported on the current platform.
The final line should say whether the selftest passed or failed.

If the selftest failed, please visit https://github.com/kohlschutter/junixsocket/issues
and file a new bug report with the output below.

junixsocket selftest version 2.6.2

Git properties:

git.build.version: 2.6.2
git.commit.id.abbrev: 3c63011
git.commit.id.describe: junixsocket-2.6.2
git.commit.id.full: 3c63011ee29f9a33c511194abf9943ca5ec96850
git.commit.time: 2023-02-08T21:15:43+01:00
git.dirty: false

System properties:

awt.toolkit: sun.awt.X11.XToolkit
com.alibaba.wisp.allThreadAsWisp: true
com.alibaba.wisp.enableThreadAsWisp: true
com.alibaba.wisp.transparentWispSwitch: true
file.encoding: ANSI_X3.4-1968
file.separator: /
java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
java.awt.printerjob: sun.print.PSPrinterJob
java.class.path: ling.new.jar
java.class.version: 55.0
java.home: /root/dragonwell-11.0.18.14+9-GA
java.io.tmpdir: /tmp
java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
java.runtime.name: OpenJDK Runtime Environment
java.runtime.version: 11.0.18.14+9
java.specification.name: Java Platform API Specification
java.specification.vendor: Oracle Corporation
java.specification.version: 11
java.vendor: Alibaba
java.vendor.url: http://www.alibabagroup.com
java.vendor.url.bug: mailto:dragonwell_use@googlegroups.com
java.vendor.version: (Alibaba Dragonwell Extended Edition)-11.0.18.14+9-GA
java.version: 11.0.18.14
java.version.date: 2023-01-17
java.vm.compressedOopsMode: Zero based
java.vm.info: mixed mode
java.vm.name: OpenJDK 64-Bit Server VM
java.vm.specification.name: Java Virtual Machine Specification
java.vm.specification.vendor: Oracle Corporation
java.vm.specification.version: 11
java.vm.vendor: Alibaba
java.vm.version: 11.0.18.14+9
jdk.debug: release
line.separator: \n
os.arch: amd64
os.name: Linux
os.version: 5.15.39-4-pve
path.separator: :
sun.arch.data.model: 64
sun.boot.library.path: /root/dragonwell-11.0.18.14+9-GA/lib
sun.cpu.endian: little
sun.cpu.isalist: 
sun.io.unicode.encoding: UnicodeLittle
sun.java.command: ling.new.jar
sun.java.launcher: SUN_STANDARD
sun.jnu.encoding: ANSI_X3.4-1968
sun.management.compiler: HotSpot 64-Bit Tiered Compilers
sun.os.patch.level: unknown
user.country: US
user.dir: /root
user.home: /root
user.language: en
user.name: root
user.timezone: 

BEGIN contents of file: /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
=END= contents of file: /etc/os-release

BEGIN contents of file: /etc/debian_version
12.0
=END= contents of file: /etc/debian_version

AFSocket.isSupported: true

AFUNIXSocket.isSupported: true

kohlschuetter commented 1 year ago

It looks like Wisp2 actively prevents any custom SocketImpl implementations; see their Socket.java implementation here

Without having looked too deeply, I think dragonwell could change their Socket implementation in a way that checks if the subclass actually exposes a SocketChannel (i.e., Socket#getChannel() != null) and use that one with WispSocketImpl as if that Socket had been constructed with that SocketChannel.

Before committing any further resources, I assume it's no longer important since appears Wisp2 development has stalled, right? At least I can't find any references in dragonwell17.