初始化 Couchbase java 客户端时出现内存不足错误
初始化 Couchbase Java 客户端时遇到内存不足错误。该问题发生在 Gradle 构建中运行测试用例的上下文中。运行单个测试用例时似乎不会发生这种情况。这似乎是在运行构建中的所有测试用例时发生的。该错误发生在 MacOS 上,而不是 Linux 构建机器上
环境
JVM = 16 (OpenJDK)
OS = MacOS Monterey
task = Gradle build
jvm memory settings = -Xmx8000m" "-Xms512m" "-XX:MaxDirectMemorySize=2000m"
StackTrace -
Caused by: java.lang.OutOfMemoryError: Cannot reserve 16384 bytes of direct buffer memory (allocated: 536861104, limit: 536870912)
at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:121)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:330)
at com.couchbase.client.core.deps.io.netty.channel.unix.Buffer.allocateDirectWithNativeOrder(Buffer.java:40)
at com.couchbase.client.core.deps.io.netty.channel.unix.IovArray.<init>(IovArray.java:72)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoop.<init>(KQueueEventLoop.java:62)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:151)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:32)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:60)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:49)
at com.couchbase.client.core.deps.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:110)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:97)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:73)
at com.couchbase.client.core.env.IoEnvironment.createEventLoopGroup(IoEnvironment.java:476)
at com.couchbase.client.core.env.IoEnvironment.<init>(IoEnvironment.java:285)
at com.couchbase.client.core.env.IoEnvironment.<init>(IoEnvironment.java:66)
at com.couchbase.client.core.env.IoEnvironment$Builder.build(IoEnvironment.java:674)
at com.couchbase.client.core.env.CoreEnvironment.<init>(CoreEnvironment.java:153)
at com.couchbase.client.java.env.ClusterEnvironment.<init>(ClusterEnvironment.java:53)
at com.couchbase.client.java.env.ClusterEnvironment.<init>(ClusterEnvironment.java:46)
at com.couchbase.client.java.env.ClusterEnvironment$Builder.build(ClusterEnvironment.java:213)
Facing out of memory error on initializing Couchbase Java Client. The issue happens in the context of running Test cases in the Gradle build. It doesn't seem to be happening when running individual test cases. It seems to be happening on running all test cases in the build. The error is occurring on MacOS and not on Linux build machine
Environment
JVM = 16 (OpenJDK)
OS = MacOS Monterey
task = Gradle build
jvm memory settings = -Xmx8000m" "-Xms512m" "-XX:MaxDirectMemorySize=2000m"
StackTrace -
Caused by: java.lang.OutOfMemoryError: Cannot reserve 16384 bytes of direct buffer memory (allocated: 536861104, limit: 536870912)
at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:121)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:330)
at com.couchbase.client.core.deps.io.netty.channel.unix.Buffer.allocateDirectWithNativeOrder(Buffer.java:40)
at com.couchbase.client.core.deps.io.netty.channel.unix.IovArray.<init>(IovArray.java:72)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoop.<init>(KQueueEventLoop.java:62)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:151)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:32)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:60)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:49)
at com.couchbase.client.core.deps.io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:110)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:97)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.<init>(KQueueEventLoopGroup.java:73)
at com.couchbase.client.core.env.IoEnvironment.createEventLoopGroup(IoEnvironment.java:476)
at com.couchbase.client.core.env.IoEnvironment.<init>(IoEnvironment.java:285)
at com.couchbase.client.core.env.IoEnvironment.<init>(IoEnvironment.java:66)
at com.couchbase.client.core.env.IoEnvironment$Builder.build(IoEnvironment.java:674)
at com.couchbase.client.core.env.CoreEnvironment.<init>(CoreEnvironment.java:153)
at com.couchbase.client.java.env.ClusterEnvironment.<init>(ClusterEnvironment.java:53)
at com.couchbase.client.java.env.ClusterEnvironment.<init>(ClusterEnvironment.java:46)
at com.couchbase.client.java.env.ClusterEnvironment$Builder.build(ClusterEnvironment.java:213)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论