OutOfDirectMemoryError

913 views
Skip to first unread message

zhangc82

unread,
Oct 19, 2021, 1:10:38 AM10/19/21
to Gatling User Group
Hi,

Appreicate if I can get some help on this one.  My test is running into this issue.  

01:42:13.272 [ERROR] i.g.h.c.i.HttpAppHandler - Fatal error io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 1056964615, max: 1073741824)



I looked at the history of this user group that it mentioned I should set -XX:MaxDirectMemorySize, I tried a few things but I cannot find where should I set this argument.

I am using maven with command line:

mvn gatling:test -Dgatling.simulationClass=myCom.ClientWorkflowSimulation


Daniil Z

unread,
Oct 19, 2021, 3:23:47 AM10/19/21
to Gatling User Group
Hi, 


export MAVEN_OPTS="-XmsYourValueg -XmxYourValueg -XX:MaxDirectMemorySize=YourValuem"



zhangc82

unread,
Oct 20, 2021, 1:32:08 AM10/20/21
to Gatling User Group
I am using jenkins to start the test, I set  -XX:MaxDirectMemorySize=2g under jenkins maven but it doesn't seem to work

Any other solutions? 

zhangc82

unread,
Oct 20, 2021, 1:32:17 AM10/20/21
to Gatling User Group
I tried on jenkins execute shell with

export MAVEN_OPTS="-Xmx4096M -XX:MaxDirectMemorySize=2g"
mvn gatling:test -Dgatling.simulationClass=ClientWorkflowSimulation

but i am still getting the same error as it were not taking in my maven setting

01:24:01.149 [ERROR] i.g.h.c.i.HttpAppHandler - Fatal error io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 1056964615, max: 1073741824) at io.netty.util.internal.PlatformDependent.incrementMemoryCounter(PlatformDependent.java:775) at io.netty.util.internal.PlatformDependent.allocateDirectNoCleaner(PlatformDependent.java:730) at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:645) at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:621) at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:204) at io.netty.buffer.PoolArena.tcacheAllocateSmall(PoolArena.java:174) at io.netty.buffer.PoolArena.allocate(PoolArena.java:136) at io.netty.buffer.PoolArena.allocate(PoolArena.java:128) at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:378) at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187) at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178) at io.netty.handler.ssl.SslHandler.allocate(SslHandler.java:2210) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1382) at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1282) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1329) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)
On Tuesday, October 19, 2021 at 3:23:47 AM UTC-4 danie...@gmail.com wrote:

Daniil Z

unread,
Oct 20, 2021, 9:53:42 AM10/20/21
to Gatling User Group

zhangc82

unread,
Oct 22, 2021, 1:27:44 AM10/22/21
to Gatling User Group
Hi 

Thanks for helping out here unfortunately it still have the problem.  I looked at the processes when my gatling test runs, I saw two java processes, the 1st one is started by me and the 2nd one I believed is started by gatling.

In the 2nd java process, there is a -Xmx1G config, I am suspecting this is the culprit that caused my OutOfDirectMemory error, how do I change this process setting?  It is invoked by gatling i think

process 1:
root     1442480 1442437  0 01:08 pts/0    00:00:11 /bin/java -Xmx4096M -classpath /opt/maven/boot/plexus-classworlds-2.6.0.jar -Dclassworlds.conf=/opt/maven/bin/m2.conf -Dmaven.home=/opt/maven -Dlibrary.jansi.path=/opt/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/var/lib/jenkins/workspace/QA_Performance_Test org.codehaus.plexus.classworlds.launcher.Launcher gatling:test -Dgatling.simulationClass=ClientWorkflowSimulation

process 2:
root     1442572 1442480 16 01:08 pts/0    00:05:20 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el8_4.x86_64/jre/bin/java -server -Xmx1G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:MaxInlineLevel=20 -XX:MaxTrivialSize=12 -XX:-UseBiasedLocking -Djdk.net.URLClassPath.disableClassPathURLCheck=true -Dgatling.simulationClass=ClientWorkflowSimulation -Dlibrary.jansi.path=/opt/maven/lib/jansi-native -jar /tmp/gatlingbooter7006757122097394169.jar io.gatling.app.Gatling /tmp/gatling-maven-plugin-1976583146813467598.args

Stéphane LANDELLE

unread,
Oct 22, 2021, 3:04:23 AM10/22/21
to gat...@googlegroups.com
Have you checked the documentation of the gatling-maven-plugin? In particular the configuration? https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/#configuration
--

Stéphane Landelle

Chief Technical Officer

   

slan...@gatling.io
gatling.io
   
facebook twitter linkedin 


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/bd731b06-d66e-4318-b611-bdcb16ca7229n%40googlegroups.com.

zhangc82

unread,
Oct 22, 2021, 3:30:49 PM10/22/21
to Gatling User Group
Thanks  Stéphane for pointing me to the right direction, really appreciate it.
Reply all
Reply to author
Forward
0 new messages