leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
445 stars 21 forks source link

Uncaught (in promise) Monitoring of Synchronizer Usage is not supported. #126

Closed andy98725 closed 3 years ago

andy98725 commented 3 years ago

Error


cheerpjThrow | @ | loader.js:2264
-- | -- | --
  | _c4pbMlarMZa0ayqWq0mvt3EeramiY8SyxxG0m0ramS4iOqmyugel5DFd | @ | rt.jar.sun.management.js:623
  | eval | @ | VM610:3
  | runContinuationStack | @ | loader.js:387
  | cheerpjSchedule | @ | loader.js:1110
  | classLoadComplete | @ | loader.js:167
  | load (async) |   |  
  | cjLoadScript |@ | loader.js:303

...

Steps to Reproduce

The call to cheerpj:

Util/cheerpj_2.1/cheerpjfy.py web/html/TextDemo.jar --deps ../.includes/MpegAudioSPI1.9.5/mp3spi1.9.5.jar:../.includes/MpegAudioSPI1.9.5/lib/jl1.0.1.jar:../.includes/MpegAudioSPI1.9.5/lib/tritonus_share.jar

The jar itself doesn't matter. When I run this without the --deps, it works. I need the dependencies for a different jar file.

The HTML File

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>CheerpJ test</title>
    <script src="https://cjrtnc.leaningtech.com/2.1/loader.js"></script>
  </head>
  <body>
  </body>
  <script>
      cheerpjInit();
      cheerpjCreateDisplay(800,600);
      cheerpjRunMain("main.Application", "/app/TextDemo.jar"); 
  </script>
</html>

I'm using Tritonus to play audio for my game. If this is an issue in regards to that library, I'm happy to rewrite a bit if someone could suggest a better library.

Am I missing a step in configuring cheerpJ for dependencies?

andy98725 commented 3 years ago

I also get the same error when I run cheerpj without the dependencies (I now realize this was superfluous since the libraries are included in the compiled jar already).

I also get the same error when I compile the game without the dependencies (runs fine locally with some extra audioFormatExceptions), so it may not even be tied to the dependencies after all.

The builtin audio system is using javax- does this work with cheerpj?

marsicplusplus commented 3 years ago

Hi @andy98725,

Could we get a minimal test case to reproduce the issue and be able to debug it?

andy98725 commented 3 years ago

I couldn't isolate what was triggering the problem from my code, so I included the full game build in a separate repo here for testing:

https://github.com/andy98725/Base-Wars-Test-Build

In the root directory of that repo,

python .\cheerpj_2.1\cheerpjfy.py Base_Wars.jar
python -m http.server 8080

Gets the error "Uncaught (in promise) Monitoring of Synchronizer Usage is not supported." in console, right after "Run main for main/Application".

Done on Windows 10.

andy98725 commented 3 years ago

@marsicplusplus, any updates on this?

If it's an incompatibility with a specific library or package, I'm happy to refactor to a different one. I've been searching for a Java -> JS transpiler quite some time for it, so I'd be ecstatic to see it working.

If it helps, I can make the source repo public temporarily. Let me know if there's anything else I could do to help out.

marsicplusplus commented 3 years ago

Hi @andy98725.

I was able to reproduce the issue with a local build of CheerpJ, but I did not have the time to look into it yet.

I´ll try to check back before the end of the week.

andy98725 commented 3 years ago

Checking on the status of this again. What would be a timeframe this could be fixed by? No pressure- just scheduling for my current project.

marsicplusplus commented 3 years ago

Hi @andy98725 .

Unfortunately we had to do some work for commercial customers before we could get to check on your issue.

However I have now tested your applet on a more recent build of CheerpJ and the issue appears on there as well. The message Monitoring of Synchronizer Usage is not supported. can be printed by two different method in ThreadImpl.java in the JDK.

Those two methods ( public long[] findDeadlockedThreads and private void verifyDumpThreads) check if the JVM supports a feature needed to inspect the state of the stack.

In CheerpJ this feature is not implemented. Since it is not trivial to add this functionality and since there is not enough commercial interest for us to spend time on this right now, we will add this issue in our internal tracker and we will eventually contact you if we get to add this to our product.

Best, Lorenzo