You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by KHALIFA-SH December 16, 2023
I have Used the log4j2 appender in MuleSoft project and I'm getting an outOfMemory Error when sending logs to Loki.
Attached the stack trace...
When I upgrade the worker size to at least 0.2 V core I don't see this error. I just want to ask if there is something I can do to avoid this error with minimal worker size (.01 v core).
Initializing app 'grafana-loki-test' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ERROR StatusConsoleListener Could not create plugin of type class pl.tkowalcz.tjahzi.log4j2.LokiAppender for element Loki: java.lang.OutOfMemoryError: Direct buffer memory
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:695)
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:123)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
at pl.tkowalcz.tjahzi.TjahziInitializer.allocateJavaBuffer(TjahziInitializer.java:101)
at pl.tkowalcz.tjahzi.TjahziInitializer.createLoggingSystem(TjahziInitializer.java:32)
at pl.tkowalcz.tjahzi.log4j2.LokiAppenderBuilder.build(LokiAppenderBuilder.java:152)
at pl.tkowalcz.tjahzi.log4j2.LokiAppenderBuilder.build(LokiAppenderBuilder.java:30)
....
ERROR StatusConsoleListener Unable to invoke factory method in class pl.tkowalcz.tjahzi.log4j2.LokiAppender for element Loki: java.lang.IllegalStateException: No factory method found for class pl.tkowalcz.tjahzi.log4j2.LokiAppender
java.lang.IllegalStateException: No factory method found for class pl.tkowalcz.tjahzi.log4j2.LokiAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:260)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
....
The text was updated successfully, but these errors were encountered:
Hi. Sorry for a late answer. The JVM has a user-settable upper limit on the maximum amount of allocatable direct buffer memory. It can be controlled by -XX:MaxDirectMemorySize=<size> option to java invocation. The stack trace indicates that you hit that limit.
The solution is to set smaller buffer like @kshkur suggests or set useOffHeapBuffer to false in Tjahzi configuration so that the buffer will be allocated on java heap.
Discussed in #120
Originally posted by KHALIFA-SH December 16, 2023
I have Used the log4j2 appender in MuleSoft project and I'm getting an outOfMemory Error when sending logs to Loki.
Attached the stack trace...
When I upgrade the worker size to at least 0.2 V core I don't see this error. I just want to ask if there is something I can do to avoid this error with minimal worker size (.01 v core).
Thank you!
Error Stack
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ERROR StatusConsoleListener Could not create plugin of type class pl.tkowalcz.tjahzi.log4j2.LokiAppender for element Loki: java.lang.OutOfMemoryError: Direct buffer memory
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:695)
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:123)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
at pl.tkowalcz.tjahzi.TjahziInitializer.allocateJavaBuffer(TjahziInitializer.java:101)
at pl.tkowalcz.tjahzi.TjahziInitializer.createLoggingSystem(TjahziInitializer.java:32)
at pl.tkowalcz.tjahzi.log4j2.LokiAppenderBuilder.build(LokiAppenderBuilder.java:152)
at pl.tkowalcz.tjahzi.log4j2.LokiAppenderBuilder.build(LokiAppenderBuilder.java:30)
....
ERROR StatusConsoleListener Unable to invoke factory method in class pl.tkowalcz.tjahzi.log4j2.LokiAppender for element Loki: java.lang.IllegalStateException: No factory method found for class pl.tkowalcz.tjahzi.log4j2.LokiAppender
java.lang.IllegalStateException: No factory method found for class pl.tkowalcz.tjahzi.log4j2.LokiAppender
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:260)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
....
The text was updated successfully, but these errors were encountered: