Posted by weickdev:
I run my java code, it works well at beginning, but after a while it throws below exception:
[pool-2-thread-1] ERROR com.haizhi.graph.lab.dgraph.datamaker.DgraphDataMaker - Node create error:
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: io.grpc.netty.NettyClientTransport$3: Frame size 6250043 exceeds maximum: 4194304.
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:210)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:191)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:124)
at io.dgraph.DgraphGrpc$DgraphBlockingStub.mutate(DgraphGrpc.java:298)
at io.dgraph.DgraphClient$Transaction.mutate(DgraphClient.java:211)
at com.haizhi.graph.lab.dgraph.datamaker.DgraphDataMaker.saveVertices(DgraphDataMaker.java:128)
at com.haizhi.graph.lab.dgraph.datamaker.DgraphDataMaker.lambda$ansySaveVertex$3(DgraphDataMaker.java:146)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-2-thread-1" io.dgraph.TxnFinishedException: Transaction has already been committed or discarded
at io.dgraph.DgraphClient$Transaction.commit(DgraphClient.java:243)
at com.haizhi.graph.lab.dgraph.datamaker.DgraphDataMaker.saveVertices(DgraphDataMaker.java:132)
at com.haizhi.graph.lab.dgraph.datamaker.DgraphDataMaker.lambda$ansySaveVertex$3(DgraphDataMaker.java:146)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
my code looks like:
private void saveVertices(List<Map<String, Object>> itemList) {
long startTime = System.currentTimeMillis();
DgraphClient.Transaction transaction = dgraphClient.newTransaction();
try {
try {
logger.info("saving {} items", itemList.size());
String json = JSON.toJSONString(itemList);
DgraphProto.Mutation mutation = DgraphProto.Mutation.newBuilder().setIgnoreIndexConflict(true).setSetJson(ByteString.copyFromUtf8(json)).build();
transaction.mutate(mutation);
} catch (Exception e) {
logger.error("Node create error: ", e);
}
transaction.commit();
} finally {
transaction.discard();
}
logger.info("save {} items costs {}ms", itemList.size(), System.currentTimeMillis() - startTime);
}