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

seata-server throw java.lang.OutOfMemoryError: Direct buffer memory #1368

Closed
1 task done
runcoding opened this issue Jul 30, 2019 · 6 comments
Closed
1 task done

seata-server throw java.lang.OutOfMemoryError: Direct buffer memory #1368

runcoding opened this issue Jul 30, 2019 · 6 comments
Labels
type: bug Category issues or prs related to bug.

Comments

@runcoding
Copy link

runcoding commented Jul 30, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

In idea debug,springcloud-jpa-seata/order-service

@Transactional(rollbackFor = Exception.class)
public void create(String userId, String commodityCode, Integer count)  {

    BigDecimal orderMoney = new BigDecimal(count).multiply(new BigDecimal(5));
    Order order = new Order();
    order.setUserId(userId);
    order.setCommodityCode(commodityCode);
    order.setCount(count);
    order.setMoney(orderMoney);
    orderDAO.save(order);

    /** debug  breakpoint */
    storageFeignClient.deduct(commodityCode, count);
}

"seata-server java.lang.OutOfMemoryError: Direct buffer memory" appears during debugging.

Ⅱ. Describe what happened

seata-server console OOM

2019-07-30 14:26:48.874 ERROR[NettyServerNIOWorker_8_8]io.seata.core.rpc.netty.AbstractRpcRemoting.exceptionCaught:424 -0318
java.lang.OutOfMemoryError: Direct buffer memory
	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
	at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:764)
	at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:740)
	at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:244)
	at io.netty.buffer.PoolArena.allocate(PoolArena.java:214)
	at io.netty.buffer.PoolArena.allocate(PoolArena.java:146)
	at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:324)
	at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:185)
	at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:176)
	at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:137)
	at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:114)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:147)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:545)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:835)

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

Seata now support Debug?

Ⅵ. Environment:

  • seata-server version: v0.7.1
  • JDK version : jdk8
  • OS : mac
  • Others:
    VM Flags:
    -Xmx1G
    -Xms1G
    -Xmn256M
    -XX:MaxMetaspaceSize=256M
    -XX:MaxDirectMemorySize=1G
    -XX:MetaspaceSize=256M
    -XX:+UseParallelGC
    -XX:+UseAdaptiveSizePolicy
    -XX:MaxGCPauseMillis=100
@fescar-robot fescar-robot added the type: bug Category issues or prs related to bug. label Jul 30, 2019
@fescar-robot
Copy link

Hi @runcoding, we detect non-English characters in the issue. This comment is an auto translation from @fescar-robot to help other users to understand this issue.
We encourage you to describe your issue in English which is more friendly to other users.

seata-server throw java.lang.OutOfMemoryError: Direct buffer memory

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

In idea debug,springcloud-jpa-seata/order-service

@Transactional(rollbackFor = Exception.class)
public void create(String userId, String commodityCode, Integer count)  {

    BigDecimal orderMoney = new BigDecimal(count).multiply(new BigDecimal(5));
    Order order = new Order();
    order.setUserId(userId);
    order.setCommodityCode(commodityCode);
    order.setCount(count);
    order.setMoney(orderMoney);
    orderDAO.save(order);

/**Deduction inventory debug breakpoint */
    storageFeignClient.deduct(commodityCode, count);
}

"seata-server java.lang.OutOfMemoryError: Direct buffer memory" appears during debugging.

Ⅱ. Describe what happened

2019-07-30 14:26:48.874 ERROR[NettyServerNIOWorker_8_8]io.seata.core.rpc.netty.AbstractRpcRemoting.exceptionCaught:424 -0318
java.lang.OutOfMemoryError: Direct buffer memory
	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
	at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:764)
	at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:740)
	at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:244)
	at io.netty.buffer.PoolArena.allocate(PoolArena.java:214)
	at io.netty.buffer.PoolArena.allocate(PoolArena.java:146)
	at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:324)
	at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:185)
	at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:176)
	at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:137)
	at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:114)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:147)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:545)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:835)
Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

Ⅴ. Anything else we need to know?

Seata now support Debug?

Ⅵ. Environment:

  • JDK version : jdk8
  • OS : mac
  • Others:
    VM Flags:
    -Xmx1G
    -Xms1G
    -Xmn256M
    -XX:MaxMetaspaceSize=256M
    -XX:MaxDirectMemorySize=1G
    -XX:MetaspaceSize=256M
    -XX:+UseParallelGC
    -XX:+UseAdaptiveSizePolicy
    -XX:MaxGCPauseMillis=100

@hermeshephaestus
Copy link

hermeshephaestus commented Jul 30, 2019

which seata server version you used

@runcoding
Copy link
Author

@hermeshephaestus seata-server version: v0.7.1

@slievrly
Copy link
Member

Can you attach seata's log file?

@runcoding
Copy link
Author

runcoding commented Jul 31, 2019

@slievrly

file seata-server.log

2019-07-31 11:17:49,049 ERROR 0318
java.lang.OutOfMemoryError: Direct buffer memory
	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
	at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:764)
       ……
2019-07-31 11:23:44.635 ERROR[RetryRollbacking_1]io.seata.server.coordinator.DefaultCore.doGlobalRollback:308 -Successfully rollbacked branch BR:2018271067/2018271065
2019-07-31 11:23:44.636 INFO [RetryRollbacking_1]io.seata.core.rpc.ChannelManager.getChannel:357 -Just got exactly the one [id: 0xb590fa83, L:/127.0.0.1:8091 - R:/127.0.0.1:61723] for storage-service:127.0.0.1:61723
2019-07-31 11:23:44.747 ERROR[RetryRollbacking_1]io.seata.server.coordinator.DefaultCore.doGlobalRollback:308 -Successfully rollbacked branch BR:2018271066/2018271065
2019-07-31 11:23:49.442 ERROR[ServerHandlerThread_28_500]io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate:123 -Catch RuntimeException while do RPC, request: xid=192.168.0.137:8091:2018271065,extraData=null
java.lang.NullPointerException: null
	at io.seata.server.coordinator.DefaultCore.getStatus(DefaultCore.java:343)
	at io.seata.server.coordinator.DefaultCoordinator.doGlobalStatus(DefaultCoordinator.java:167)
	at io.seata.server.AbstractTCInboundHandler$7.execute(AbstractTCInboundHandler.java:220)
	at io.seata.server.AbstractTCInboundHandler$7.execute(AbstractTCInboundHandler.java:216)
	at io.seata.core.exception.AbstractExceptionHandler.exceptionHandleTemplate(AbstractExceptionHandler.java:117)
	at io.seata.server.AbstractTCInboundHandler.handle(AbstractTCInboundHandler.java:216)
	at io.seata.core.protocol.transaction.GlobalStatusRequest.handle(GlobalStatusRequest.java:35)
	at io.seata.server.coordinator.DefaultCoordinator.onRequest(DefaultCoordinator.java:430)
	at io.seata.core.rpc.DefaultServerMessageListenerImpl.onTrxMessage(DefaultServerMessageListenerImpl.java:87)
	at io.seata.core.rpc.netty.RpcServer.dispatch(RpcServer.java:252)
	at io.seata.core.rpc.netty.AbstractRpcRemoting$3.run(AbstractRpcRemoting.java:371)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:835)

@slievrly
Copy link
Member

slievrly commented Jul 31, 2019

@runcoding has fixed in develop branch #1333 #1313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Category issues or prs related to bug.
Projects
None yet
Development

No branches or pull requests

5 participants