Return a proper error to gRPC clients on OutOfMemoryError
Server log:
Feb 28 13:36:06 swh1.enst.fr swh[689244]: Exception in thread "pool-1-thread-40" java.lang.OutOfMemoryError: Java heap space
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.Arrays.copyOf(Arrays.java:3481)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.ArrayDeque.grow(ArrayDeque.java:149)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.ArrayDeque.addLast(ArrayDeque.java:307)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.ArrayDeque.add(ArrayDeque.java:494)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visitEdge(Traversal.java:225)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$SimpleTraversal.visitEdge(Traversal.java:307)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visitNode(Traversal.java:218)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$SimpleTraversal.visitNode(Traversal.java:281)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visitStep(Traversal.java:197)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.Traversal$BFSVisitor.visit(Traversal.java:173)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.GraphServer$TraversalService.countNodes(GraphServer.java:272)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at org.softwareheritage.graph.rpc.TraversalServiceGrpc$MethodHandlers.invoke(TraversalServiceGrpc.java:826)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
Feb 28 13:36:06 swh1.enst.fr swh[689244]: at java.base/java.lang.Thread.run(Thread.java:833)
Client log:
Traceback (most recent call last):
File "/home/infres/ext-8972/swh-environment/swh-graph/swh/graph/luigi/blobs_datasets.py", line 354, in _worker
res = await self.process_one(row)
File "/home/infres/ext-8972/swh-environment/swh-graph/swh/graph/luigi/blobs_datasets.py", line 918, in process_one
response = await self.stub.CountNodes(
File "/home/infres/ext-8972/.local/lib/python3.9/site-packages/grpc/aio/_call.py", line 290, in __await__
raise _create_rpc_error(self._cython_call._initial_metadata,
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = ""
debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B::1%5D:50093 {created_time:"2023-02-28T13:36:06.596819908+01:00", grpc_status:2, grpc_message:""}"
It's very unhelpful to clients not to explain what the error is