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

Module Dependency load order not respected #1301

Open
1 task done
DasBabyPixel opened this issue Aug 26, 2023 · 0 comments · May be fixed by #1302
Open
1 task done

Module Dependency load order not respected #1301

DasBabyPixel opened this issue Aug 26, 2023 · 0 comments · May be fixed by #1302
Labels
s: needs triage Issue waiting for triage t: bug Something isn't working as intended

Comments

@DasBabyPixel
Copy link
Contributor

Stacktrace

[26.08 23:33:42.885] SEVERE: Exception in thread "main"
[26.08 23:33:42.886] SEVERE: dev.derklaro.aerogel.AerogelException: Unable to invoke method private void eu.cloudnetservice.node.Node.updateAndLoadModules(eu.cloudnetservice.node.module.ModulesHolder,eu.cloudnetservice.driver.module.ModuleProvider,eu.cloudnetservice.node.module.updater.ModuleUpdater,eu.cloudnetservice.node.module.updater.ModuleUpdaterRegistry) throws java.lang.Exception
[26.08 23:33:42.886] SEVERE: Caused by: java.lang.NoClassDefFoundError: de/dasbabypixel/dependencymodule/TestApiClass
[26.08 23:33:42.886] SEVERE:    at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
[26.08 23:33:42.886] SEVERE:    at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
[26.08 23:33:42.886] SEVERE:    at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.member.MemberTree.buildTree(MemberTree.java:90)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.member.DefaultMemberInjector.<init>(DefaultMemberInjector.java:91)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.DefaultSpecifiedInjector.lambda$memberInjector$0(DefaultSpecifiedInjector.java:127)
[26.08 23:33:42.886] SEVERE:    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.DefaultSpecifiedInjector.memberInjector(DefaultSpecifiedInjector.java:125)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.context.MemberInjectionRequest.executeMemberInjection(MemberInjectionRequest.java:72)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.context.DefaultInjectionContext.finishConstruction(DefaultInjectionContext.java:527)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstanceAndRemoveContext(ContextInstanceResolveHelper.java:100)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstance(ContextInstanceResolveHelper.java:79)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstance(ContextInstanceResolveHelper.java:63)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.DefaultSpecifiedInjector.instance(DefaultSpecifiedInjector.java:310)
[26.08 23:33:42.886] SEVERE:    at dev.derklaro.aerogel.internal.DefaultSpecifiedInjector.instance(DefaultSpecifiedInjector.java:292)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.inject.DefaultInjectionLayer.instance(DefaultInjectionLayer.java:58)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.DefaultModuleProvider.loadModule(DefaultModuleProvider.java:229)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.DefaultModuleProvider.loadModule(DefaultModuleProvider.java:250)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.DefaultModuleProvider.lambda$loadAll$3(DefaultModuleProvider.java:261)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.common.io.FileUtil.walkFileTree(FileUtil.java:352)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.common.io.FileUtil.walkFileTree(FileUtil.java:318)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.DefaultModuleProvider.loadAll(DefaultModuleProvider.java:259)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.node.Node.updateAndLoadModules(Node.java:234)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.util.MethodHandleUtil.invokeMethod(MethodHandleUtil.java:71)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.member.DefaultMemberInjector$InjectableMethod.invoke(DefaultMemberInjector.java:584)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.member.DefaultMemberInjector.injectMethod(DefaultMemberInjector.java:371)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.member.DefaultMemberInjector.injectInstanceMethods(DefaultMemberInjector.java:330)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.member.DefaultMemberInjector.inject(DefaultMemberInjector.java:166)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.context.MemberInjectionRequest.executeMemberInjection(MemberInjectionRequest.java:73)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.context.DefaultInjectionContext.finishConstruction(DefaultInjectionContext.java:527)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstanceAndRemoveContext(ContextInstanceResolveHelper.java:100)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstance(ContextInstanceResolveHelper.java:79)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.context.util.ContextInstanceResolveHelper.resolveInstance(ContextInstanceResolveHelper.java:63)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.DefaultInjector.instance(DefaultInjector.java:139)
[26.08 23:33:42.887] SEVERE:    at dev.derklaro.aerogel.internal.DefaultInjector.instance(DefaultInjector.java:121)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.inject.DefaultInjectionLayer.instance(DefaultInjectionLayer.java:58)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.inject.UncloseableInjectionLayer.instance(UncloseableInjectionLayer.java:58)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.node.boot.Bootstrap.main(Bootstrap.java:66)
[26.08 23:33:42.887] SEVERE: Caused by: java.lang.ClassNotFoundException: de.dasbabypixel.dependencymodule.TestApiClass
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.ModuleURLClassLoader.loadClass(ModuleURLClassLoader.java:155)
[26.08 23:33:42.887] SEVERE:    at eu.cloudnetservice.driver.module.ModuleURLClassLoader.loadClass(ModuleURLClassLoader.java:110)
[26.08 23:33:42.887] SEVERE:    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[26.08 23:33:42.887] SEVERE:    ... 38 more

Actions to reproduce

We have a main module and a dependency module

Step 1: Set dependency module as a dependency of main module
Step 2: In the main class of the main module use a class from the dependency module in a manner that the injector loads that class during instantiation of the main of the main module.
(Injecting in any @ModuleTask breaks it just fine)

Hope that the FileSystem decides to load the main module before the dependency module (To get the error, if dependency module gets loaded first then there is no error)

CloudNet version

[26.08 23:23:37.381] INFO:
[26.08 23:23:37.382] INFO: CloudNet Blizzard 4.0.0-RC10-SNAPSHOT 5ea5b64
[26.08 23:23:37.383] INFO: Discord: https://discord.cloudnetservice.eu/
[26.08 23:23:37.383] INFO:
[26.08 23:23:37.384] INFO: ClusterId: 9da8725e--481a--4b9b7fbc608f
[26.08 23:23:37.384] INFO: NodeId: Node-1
[26.08 23:23:37.385] INFO: Head-NodeId: Node-1
[26.08 23:23:37.385] INFO: CPU usage: (P/S) .87/19.71/100%
[26.08 23:23:37.386] INFO: Node services memory allocation (U/R/M): 0/0/4096 MB
[26.08 23:23:37.386] INFO: Threads: 20
[26.08 23:23:37.386] INFO: Heap usage: 46/256MB
[26.08 23:23:37.387] INFO: JVM: Eclipse Adoptium 17 (OpenJDK 64-Bit Server VM 17.0.6+10)
[26.08 23:23:37.387] INFO: Update Repo: CloudNetService/launchermeta, Update Branch: beta (development mode)
[26.08 23:23:37.388] INFO:

Other

I made a demo project here
There are precompiled binaries in the releases
With just those two in the modules it already fails for me on windows.
Might differ on systems as stated by the DirectoryStream javadoc
image
Intelligently renaming the files should be able to break the order in case it works with the demo.

Provided the underlying file system always returns files in the same order, renaming is also able to fix the order.

For me renaming the dependencymodule from my demo to mdependency.jar (from dependencymodule.jar) fixes it

Issue uniqueness

  • Yes, this issue is unique. There are no similar issues.
@DasBabyPixel DasBabyPixel added s: needs triage Issue waiting for triage t: bug Something isn't working as intended labels Aug 26, 2023
@DasBabyPixel DasBabyPixel linked a pull request Aug 27, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: needs triage Issue waiting for triage t: bug Something isn't working as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant