Col-E / Recaf

The modern Java bytecode editor
https://recaf.coley.software
MIT License
5.99k stars 463 forks source link

Empty create workspace window #612

Closed bojanv55 closed 5 months ago

bojanv55 commented 2 years ago

When I run on latest dev3 branch (gradlew run), and when I add jar files to recaf gui in windows, I get this "Create Workspace" window that I cannot close and it is empty. Can only kill the app.

image

Amejonah1200 commented 2 years ago

image

Col-E commented 2 years ago

Cannot reproduce on my end:

https://user-images.githubusercontent.com/21371686/196528833-22a10fe5-dda7-413b-be1e-fbb8feccaa57.mp4

bojanv55 commented 2 years ago

I think this is the reason of empty window (happens when empty window is shown).

java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)
bojanv55 commented 2 years ago

btw. is this one normal when opening jar?

22:01:51.559 [ContentSource:INFO] Read 9005 classes, 70 files
22:01:52.325 [CompileDependencyUpdater:INFO] Attempting to generate phantoms, analyzing 9005 classes...
22:02:02.102 [CompileDependencyUpdater:ERROR] Failed to generate phantom classes
org.clyze.jphantom.exc.InsolvableConstraintException: java.lang.Object <: javafx.scene.Node
    at org.clyze.jphantom.constraints.solvers.BasicSolver.solveClassGraph(BasicSolver.java:176)
    at org.clyze.jphantom.constraints.solvers.InterfaceSolver.solve(InterfaceSolver.java:134)
    at org.clyze.jphantom.constraints.solvers.AbstractSolver.solve(AbstractSolver.java:54)
    at org.clyze.jphantom.constraints.solvers.InterfaceSolver.solve(InterfaceSolver.java:66)
    at org.clyze.jphantom.constraints.solvers.BasicSolver.solve(BasicSolver.java:147)
    at org.clyze.jphantom.constraints.solvers.BasicSolver.solve(BasicSolver.java:13)
    at org.clyze.jphantom.constraints.solvers.ForwardingSolver.solve(ForwardingSolver.java:36)
    at org.clyze.jphantom.constraints.solvers.ForwardingSolver.solve(ForwardingSolver.java:36)
    at org.clyze.jphantom.constraints.solvers.PruningSolver.solve(PruningSolver.java:19)
    at org.clyze.jphantom.JPhantom.run(JPhantom.java:105)
    at me.coley.recaf.util.JPhantomUtil.generate(JPhantomUtil.java:76)
    at me.coley.recaf.util.CompileDependencyUpdater.createPhantoms(CompileDependencyUpdater.java:55)
    at me.coley.recaf.util.CompileDependencyUpdater.lambda$install$0(CompileDependencyUpdater.java:37)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Col-E commented 2 years ago

I think this is the reason of empty window (happens when empty window is shown).

You can use triple ` to create a prettier code block for logs and such:

foo {
  bar {
   ...
  }
}

Since its a java.lang.NullPointerException in the internal JFX logic (com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)) this isn't really something we can fix ourselves AFAIK. Normally linux users encounter all the weird JFX bugs, odd that you're on Windows and its bugging out.

Can you share your specs? Recaf can output them for you under Help > System info

btw. is this one normal when opening jar?

JPhantom fails very often. We're looking at replacing it down the line because this is unfortunately common. Though you can ignore it. The error in the log just means it did not generate phantom classes. The workspace and such was created successfully.

jumanji144 commented 2 years ago

I think this is the reason of empty window (happens when empty window is shown).

java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.NullPointerException
        at com.sun.prism.d3d.D3DResourceFactory.createPresentable(D3DResourceFactory.java:350)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:81)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:126)
        at java.base/java.lang.Thread.run(Thread.java:834)

there seems to be a problem within the JavaFX platform that your pc is using

bojanv55 commented 2 years ago
**System**
| Name | Architecture | Processors |
| -------- | -------- | -------- |
| `Windows 10` | `amd64` | `12` |

**Java**
| Version | VM name | VM vendor | Home | Supports compiler | Supports attach |
| -------- | -------- | -------- | -------- | -------- | -------- |
| `11.0.9` | `Java HotSpot(TM) 64-Bit Server VM` | `Oracle Corporation` | `C:\Program Files\Java\jdk-11.0.9` | `true` | `true` |

**JavaFX**
| Version |
| -------- |
| `19` |
jumanji144 commented 2 years ago

but we cannot be sure, there could be some weird JavaFX funnies going on but we sadly cannot reproduce the error at this current stage

jumanji144 commented 2 years ago

could you try using a diffrent jdk / jre and see if it works there?

bojanv55 commented 2 years ago

This also probably doesn't tell you anything :)

image

Col-E commented 2 years ago

This also probably doesn't tell you anything :)

Hey, I'm just happy to see a debugger screenshot. But sadly yeah I'm not familiar enough with JFX internals to figure out whats wrong here.

bojanv55 commented 2 years ago

This one fails in the end... nCreateTexture... will try other java version tomorrow... image

jumanji144 commented 2 years ago

only guess I could make the JavaFX instance is grabbing wrong texturesxit happend in the past before. Impossible to reproduce and impossible to trace

jumanji144 commented 2 years ago

my only advice is to either retry or use a diffrent jdk

bojanv55 commented 2 years ago

same with 17 and 15. got this in console also 3 times (for 11 and 17 and 15):

for 17

Unsupported JavaFX configuration: classes were loaded from 'unnamed module @794cb805'

and for 15

Oct 18, 2022 10:45:34 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @1151e434'
Col-E commented 2 years ago

Unsupported JavaFX configuration: classes were loaded from 'unnamed module @794cb805'

JavaFX wants you to use to new Jigsaw module system from Java 9+ but we don't. Ideally we'd find a way to mute the warning since it doesn't affect behavior.

bojanv55 commented 1 year ago

I actually know now how you can reproduce. Add a lot (e.g. 100 jar files) to workspace. Then when that "close workspace" window is rendered, the list control of jars is expanded to be as tall as it can - in my case it cannot fit the window and then in crashes... Guess you need to make height of that list control fixed, so that too many jars don't kill it...

What I actually wanted is to try running single .jar (which needs all those dependencies) with SSVM. Do I need to add those to workspace also, or is it possible to somehow specify classpath? If I do not add classes to workspace, SSVM complains that it cannot find some of the classes, so I guess I need to add all dependencies. When I add, now I have a different error:

java.lang.ExceptionInInitializerError
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.System$2.defineClass(System.java:2307)
    at java.lang.invoke.MethodHandles$Lookup$ClassDefiner.defineClass(MethodHandles.java:2439)
    at java.lang.invoke.InvokerBytecodeGenerator.loadMethod(InvokerBytecodeGenerator.java:320)
    at java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(InvokerBytecodeGenerator.java:751)
    at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:854)
    at java.lang.invoke.LambdaForm.prepare(LambdaForm.java:812)
    at java.lang.invoke.MethodHandle.<init>(MethodHandle.java:481)
    at java.lang.invoke.BoundMethodHandle.<init>(BoundMethodHandle.java:56)
    at java.lang.invoke.BoundMethodHandle$Species_L.<init>(BoundMethodHandle.java:222)
    at java.lang.invoke.BoundMethodHandle$Species_L.make(BoundMethodHandle.java:237)
    at java.lang.invoke.BoundMethodHandle.bindSingle(BoundMethodHandle.java:86)
    at java.lang.invoke.SimpleMethodHandle.copyWithExtendL(SimpleMethodHandle.java:71)
    at java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:474)
    at java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:92)
    at java.lang.invoke.MethodHandle.bindArgumentL(MethodHandle.java:1616)
    at java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1532)
    at java.lang.invoke.MethodHandles.constant(MethodHandles.java:5024)
    at java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:262)
    at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:341)
    at java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(DirectMethodHandle$Holder)
    at java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:134)
    at java.lang.invoke.CallSite.makeSite(CallSite.java:315)
    at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:281)
    at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:271)
    at com.sun.javafx.application.LauncherImpl.<clinit>(LauncherImpl.java:85)
    at javafx.application.Application.launch(Application.java:236)
    at io.my.app.MyLauncher.main(MyLauncher.kt:12)
jumanji144 commented 1 year ago

SSVM should be ran on java 8, in 3x you can define a remote jvm to load system libraries from because the modern ones are not implemented in SSVM yet

bojanv55 commented 1 year ago

@Nowilltolife When I change that SSVM setting to JDK17, now I get this one:

java.lang.UnsatisfiedLinkError: sun/nio/fs/WindowsNativeDispatcher.GetFileAttributesEx0(JJ)V
    at sun.nio.fs.WindowsNativeDispatcher.GetFileAttributesEx0(Native Method)
    at sun.nio.fs.WindowsNativeDispatcher.GetFileAttributesEx(WindowsNativeDispatcher.java:380)
    at sun.nio.fs.WindowsFileAttributes.get(WindowsFileAttributes.java:308)
    at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:51)
    at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
    at sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
    at java.nio.file.Files.readAttributes(Files.java:1763)
    at java.util.zip.ZipFile$Source.get(ZipFile.java:1217)
    at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
    at java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:836)
    at java.util.zip.ZipFile.<init>(ZipFile.java:247)
    at java.util.zip.ZipFile.<init>(ZipFile.java:177)
    at java.util.jar.JarFile.<init>(JarFile.java:348)
    at jdk.internal.loader.URLClassPath$JarLoader.getJarFile(URLClassPath.java:834)
    at jdk.internal.loader.URLClassPath$JarLoader$1.run(URLClassPath.java:779)
    at jdk.internal.loader.URLClassPath$JarLoader$1.run(URLClassPath.java:772)
    at java.security.AccessController.doPrivileged(Native Method)
    at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:771)
    at jdk.internal.loader.URLClassPath$JarLoader.<init>(URLClassPath.java:746)
    at jdk.internal.loader.URLClassPath$3.run(URLClassPath.java:493)
    at jdk.internal.loader.URLClassPath$3.run(URLClassPath.java:476)
    at java.security.AccessController.doPrivileged(Native Method)
    at jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:475)
    at jdk.internal.loader.URLClassPath.getLoader(URLClassPath.java:444)
    at jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:313)
    at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:695)
    at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
    at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
    at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
jumanji144 commented 1 year ago

well as i said you need to point to a jdk 8 or 9

bojanv55 commented 1 year ago

OK. So if jar is compiled with java 11 it is not possible to run in SSVM? (or is it possible by just pointing to remote jvm in that config setting)?

I also tried to do Attach to remote. Getting this one:

Exception in thread "Attach Listener" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:535)
Caused by: java.net.BindException: Address already in use: bind
        at java.base/sun.nio.ch.Net.bind0(Native Method)
        at java.base/sun.nio.ch.Net.bind(Net.java:461)
        at java.base/sun.nio.ch.Net.bind(Net.java:453)
        at java.base/sun.nio.ch.AsynchronousServerSocketChannelImpl.bind(AsynchronousServerSocketChannelImpl.java:164)
        at java.base/java.nio.channels.AsynchronousServerSocketChannel.bind(AsynchronousServerSocketChannel.java:198)
        at software.coley.instrument.Server.<init>(Server.java:50)
        at software.coley.instrument.Agent.agent(Agent.java:56)
        at software.coley.instrument.Agent.agentmain(Agent.java:39)
        ... 6 more
jumanji144 commented 1 year ago

OK. So if jar is compiled with java 11 it is not possible to run in SSVM? (or is it possible by just pointing to remote jvm in that config setting)?

It is, it just doesn't support the internal native structure of jdk 10+, that is why you can use a diffrent vm structure to load these classes in Config -> SSVM -> Remote VM, which allows you to run ssvm on java 8

I also tried to do Attach to remote. Getting this one:

Remote is done by @Col-E whichs status i do not know

Col-E commented 1 year ago

Remote isn't functional yet.

Col-E commented 5 months ago

Closing, can open a new issue if this affects 4.X