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

UnsatisfiedLinkError with detached window #4441

Closed
errael opened this issue Jul 27, 2022 · 6 comments · Fixed by #4446
Closed

UnsatisfiedLinkError with detached window #4441

errael opened this issue Jul 27, 2022 · 6 comments · Fixed by #4446
Assignees
Labels
kind:bug Bug report or fix

Comments

@errael
Copy link
Contributor

errael commented Jul 27, 2022

Apache NetBeans version

Apache NetBeans 14

What happened

With a detached NetBeans Output Window, I frequently see the following exception.

INFO [org.netbeans.core.nativeaccess.NativeWindowSystemImpl]
java.lang.UnsatisfiedLinkError: libjawt.so: cannot open shared object file: No such file or directory
	at com.sun.jna.Native.getWindowHandle0(Native Method)
	at com.sun.jna.Native$AWT.getComponentID(Native.java:2383)
	at com.sun.jna.Native.getComponentID(Native.java:326)
	at com.sun.jna.platform.WindowUtils$X11WindowUtils.getDrawable(WindowUtils.java:1747)
	at com.sun.jna.platform.WindowUtils$X11WindowUtils.access$900(WindowUtils.java:1564)
	at com.sun.jna.platform.WindowUtils$X11WindowUtils$2.run(WindowUtils.java:1769)
	at com.sun.jna.platform.WindowUtils$NativeWindowUtils.whenDisplayable(WindowUtils.java:398)
	at com.sun.jna.platform.WindowUtils$X11WindowUtils.setWindowAlpha(WindowUtils.java:1791)
	at com.sun.jna.platform.WindowUtils.setWindowAlpha(WindowUtils.java:1992)
[catch] at org.netbeans.core.nativeaccess.NativeWindowSystemImpl.setWindowAlpha(NativeWindowSystemImpl.java:91)
	at org.netbeans.core.windows.FloatingWindowTransparencyManager.turnTransparencyOff(FloatingWindowTransparencyManager.java:155)
	at org.netbeans.core.windows.FloatingWindowTransparencyManager.toggleFloatingWindowTransparency(FloatingWindowTransparencyManager.java:141)
	at org.netbeans.core.windows.FloatingWindowTransparencyManager$1$1$1.run(FloatingWindowTransparencyManager.java:74)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

How to reproduce

Not sure exactly; only sure that it needs a detached NetBeans window.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Linux harmony 5.18.10-76051810-generic #202207071639165725231022.04~7d5e891 SMP PREEMPT_DYNAMIC Fri J x86_64 x86_64 x86_64 GNU/Linux

JDK

openjdk 17

Apache NetBeans packaging

Own source build

Anything else

This issue arose when investigating #4437 (which also involves a detached window). @neilcsmith-net indicates it's not related to that issue, and requested a new issue be opened).

Some relevant info that was mentioned in that issue...

the UnsatisfiedLinkError. That's almost certainly caused by the issue fixed in java-native-access/jna#1422

Could NetBeans include jna with the fix? It's not in NB-15.
5.9.0 seems to be a year old. The fix you mentioned is in 5.11.0, end of March. The latest release, 5.12.1, is end of June.

$ jar -tvf netbeans-15-rc1-bin.zip | grep jna-
   433 Wed Jul 20 09:10:34 PDT 2022 netbeans/platform/config/Modules/org-netbeans-libs-jna-platform.xml
1729586 Wed Jul 20 09:10:34 PDT 2022 netbeans/platform/modules/ext/jna-5.9.0.jar
1343236 Wed Jul 20 09:10:34 PDT 2022 netbeans/platform/modules/ext/jna-platform-5.9.0.jar
 59224 Wed Jul 20 09:10:34 PDT 2022 netbeans/platform/modules/org-netbeans-libs-jna-platform.jar
   481 Wed Jul 20 09:10:34 PDT 2022 netbeans/platform/update_tracking/org-netbeans-libs-jna-platform.xml

Are you willing to submit a pull request?

No

Code of Conduct

Yes

@errael
Copy link
Contributor Author

errael commented Jul 27, 2022

Also in the other issue

It's due to compilation and linking options used in certain JDK builds, particularly from various Linux distros, that cause older versions of JNA not to find libjawt. If you run on another JDK like Azul or Adoptium, you shouldn't see that error.


NetBeans is using an out of date jna-jars, is that orthogonal to the JDK issue? Or a work around for the JDK issue? In particular, would this NetBeans problem disappear if it used an up to date jna?

In case it's useful

$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

Any idea if openjdk18 has it fixed?

@neilcsmith-net neilcsmith-net removed the needs:triage Requires attention from one of the committers label Jul 27, 2022
@neilcsmith-net
Copy link
Member

neilcsmith-net commented Jul 27, 2022

@matthiasblaesing I'll let you make the call on a JNA update for NB15 or NB16. Or if safer for NB15, we could add the System.loadLibrary("jawt") workaround before this code path is hit?

Any idea if openjdk18 has it fixed?

There is no bug in OpenJDK. Just different vendors using different linking options in their builds. The issue is that older builds of JNA only work with the "legacy" linking option for native binaries.

matthiasblaesing added a commit to matthiasblaesing/netbeans that referenced this issue Jul 28, 2022
@matthiasblaesing
Copy link
Contributor

JNA 5.12.1 is now about a month old. The patch level 1 indicates, that there was an issue directly found after release, which was related to the removal of finalizers in JNA core in favor of a cleaner. I'm in favor of updating and created an corresponding PR.

I reproduced the issue with the Ubuntu system JDK and found the issue fixed after the JNA update.

A prebuild binary is available here:

https://doppel-helix.eu/NetBeans-dev-dev-c6166f56bdefe2dee663b5bb26de86219e4c04ff-release.zip

@errael it would be could if you could test it.

@errael
Copy link
Contributor Author

errael commented Jul 28, 2022

@matthiasblaesing Changing only the NetBeans build, the link error goes away. Didn't notice any problems.

@matthiasblaesing
Copy link
Contributor

@errael thanks for checking
@neilcsmith-net travis and github are happy

@neilcsmith-net
Copy link
Member

Thanks @matthiasblaesing - merging now.

Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants