今天对大文件进行加签时,报异常如下:
Caused by: org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 62914560 byte(s) of direct memory (used: 75497472, max: 134217728)
提示direct memory 不足了。
查看当前的JVM参数 -XX:MaxDirectMemorySize=128M
,因为文件大小为130M,所以不足。
解决方法:
增加直接内存大小:通过JVM参数 -XX:MaxDirectMemorySize 来增加直接内存的大小。
-XX:MaxDirectMemorySize=512m
将直接内存限制设置为512MB。