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

Remove annoying logging caused by netty #61

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

Matyrobbrt
Copy link
Member

@Matyrobbrt Matyrobbrt commented Dec 28, 2023

This PR changes the logging configuration to remove two annoying and harmless exceptions that appear in userdev at debug level by filtering them out with a regex.

Exceptions removed:

[27Dec2023 12:02:40.597] [modloading-worker-0/DEBUG] [io.netty.util.internal.PlatformDependent0/]: direct buffer constructor: unavailable
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
	at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.internal.PlatformDependent0$5.run(PlatformDependent0.java:289) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
	at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:282) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:333) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:88) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.ConstantPool.<init>(ConstantPool.java:34) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.AttributeKey$1.<init>(AttributeKey.java:27) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.AttributeKey.<clinit>(AttributeKey.java:27) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at net.neoforged.neoforge.network.NetworkConstants.<clinit>(NetworkConstants.java:32) ~[neoforge-20.4.81-beta-pr-3-testpr.jar%23192%23199!/:?]
	at net.neoforged.neoforge.common.NeoForgeMod.<init>(NeoForgeMod.java:465) ~[neoforge-20.4.81-beta-pr-3-testpr.jar%23192%23199!/:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at net.neoforged.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:112) ~[language-java-2.0.6.jar%23195!/:2.0]
	at net.neoforged.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:130) ~[core-2.0.6.jar%23196!/:2.0]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]
[27Dec2023 12:02:40.606] [modloading-worker-0/DEBUG] [io.netty.util.internal.PlatformDependent0/]: jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$7 (in module io.netty.common) cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to module io.netty.common
	at jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392) ~[?:?]
	at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
	at io.netty.util.internal.PlatformDependent0$7.run(PlatformDependent0.java:411) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
	at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:402) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:333) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:88) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.ConstantPool.<init>(ConstantPool.java:34) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.AttributeKey$1.<init>(AttributeKey.java:27) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at io.netty.util.AttributeKey.<clinit>(AttributeKey.java:27) ~[netty-common-4.1.97.Final.jar%23178!/:4.1.97.Final]
	at net.neoforged.neoforge.network.NetworkConstants.<clinit>(NetworkConstants.java:32) ~[neoforge-20.4.81-beta-pr-3-testpr.jar%23192%23199!/:?]
	at net.neoforged.neoforge.common.NeoForgeMod.<init>(NeoForgeMod.java:465) ~[neoforge-20.4.81-beta-pr-3-testpr.jar%23192%23199!/:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at net.neoforged.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:112) ~[language-java-2.0.6.jar%23195!/:2.0]
	at net.neoforged.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:130) ~[core-2.0.6.jar%23196!/:2.0]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

@Matyrobbrt Matyrobbrt added the enhancement New feature or request label Dec 28, 2023
@shartte
Copy link
Contributor

shartte commented Dec 28, 2023

Are you aware of the performance impact caused by using RegexFilter? Can we not scope this to the particular logger used by Netty?

@shartte
Copy link
Contributor

shartte commented Dec 28, 2023

p.s.: We could also just open the module for netty to improve performance? :-P

@Matyrobbrt
Copy link
Member Author

p.s.: We could also just open the module for netty to improve performance? :-P

Netty is not on the module boot path.

Copy link
Contributor

@shartte shartte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Matyrobbrt Matyrobbrt merged commit 3ce905f into neoforged:main Dec 29, 2023
1 check passed
@Matyrobbrt Matyrobbrt deleted the netty-log-filter branch December 29, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants