Music Player

Music Player

3M Downloads

[1.16.4] Music Player has faild to load correctly

Ischtaratu opened this issue ยท 8 comments

commented

Describe the bug
Mod loading error has occurred

To Reproduce
install mod, and load Minecraft. It will crash on loading

Expected behavior
no crash ?

Screenshots
see attachment MC Crashlog

Versions

  • Mod version: 2.2.1.106
  • Minecraft version: 1.16.4
  • Forge version: 35.1.0
  • UTeamCore version: 3.1.13.187

Log (if crash occures)
crash-2020-11-23_04.04.48-fml.txt

commented

https://openjdk.java.net/

  • openjdk-14+36_windows-x64_bin.zip
  • openjdk-13+33_windows-x64_bin.zip
  • and so on ...
commented

New year, new thoughts!
I only use the portable version of OpenJDK without installation. Could this make a difference? Or maybe a missing% HOME% variable or something?

Earlier I programmed a few smaller mods for Minecraft myself. However, that was still in v1.7 times. So at least I still have the basic surroundings in mind.

Is there anything else I can check? Let me know! I'll try to have a look every week.

commented

Happy new year!

Well I'm not quite sure what can cause this because I cannot reproduce this issue ...
Probably its because the jdk has some diffrent internals, as the classloader "hack" use some undocumented internal fields.

My time is currently limited, but I plan to remove that classloader hack and shade the necessary libraries into the jar itself. That removes the whole classloader hack and should resolve the issue.

The music player libraries are loaded into a separate classloader without any reflection / unsafe hacks which should not be affected.

After the change to shading this should be removed

private static void addToInternalDependencies(URL url) {
try {
final Field field = TransformingClassLoader.class.getDeclaredField("delegatedClassLoader");
field.setAccessible(true);
final URLClassLoader delegatedUrlClassLoader = (URLClassLoader) field.get(Thread.currentThread().getContextClassLoader());
final Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
final Lookup lookup = MethodHandles.lookup();
UnsafeHacks.setIntField(Lookup.class.getDeclaredField("allowedModes"), lookup, -1); // This is a hack to change our lookup to trusted
final MethodHandle methodHandle = lookup.unreflectSpecial(method, URLClassLoader.class);
methodHandle.invoke(delegatedUrlClassLoader, url);
LOGGER.debug(MARKER_ADD, "Added new jar file ({}) to the transforming / delegated classloader.", url);
} catch (final Throwable ex) {
LOGGER.error(MARKER_LOAD, "Method addURL on transforming / delegated classloader could not be invoked.", ex);
}
}

and these libraries should be shaded instead:

Music-Player/build.gradle

Lines 166 to 169 in 5a33d3e

internal ("org.slf4j:slf4j-simple:1.7.26")
internal ("net.harawata:appdirs:1.0.0") {
transitive=false
}

commented

Fixed by removing the class loader hack.
Here is the build: https://www.curseforge.com/minecraft/mc-mods/music-player/files/3182247

commented

Do you have a full debug.log?
Can you try with java 8?
Or Java 11 and Java 14 should work as I have tested them

commented

sorry for delay

  1. ... full debug log see attached ...
  2. yes, Java 8 works but i would like to run my hole system incl. jdk with a more modern environment ...
  3. Java 8 works, Java 13 crash, Java 14 crash, java 15 crash ... i have no idea .. :(

crash-2020-12-05_21.45.14-fml.txt
debug.log

commented

Next i will try java 11 asap

commented

sorry for delay

No worries. Thanks for for logs and tests.
Need to find a way to reproduce this, as in my tests it worked. Are you using the normal openjdk from oracle or adoptopenjdk with the hotspot vm?