Tips Requester Thread Exception: java.lang.IllegalStateException: Queue full
Bug description
I randomly saw this error on my node:
06/25 16:30:59.721 [pool-3-thread-2] ERROR com.iota.iri.network.Node - Tips Requester Thread Exception:
java.lang.IllegalStateException: Queue full
at java.util.AbstractQueue.add(AbstractQueue.java:98) ~[na:1.8.0_171]
at java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:312) ~[na:1.8.0_171]
at com.iota.iri.network.TCPNeighbor.send(TCPNeighbor.java:91) ~[iri-1.5.0.jar:na]
at com.iota.iri.network.Node.lambda$null$6(Node.java:534) ~[iri-1.5.0.jar:na]
at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891) ~[na:1.8.0_171]
at com.iota.iri.network.Node.lambda$spawnTipRequesterThread$7(Node.java:534) ~[iri-1.5.0.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_171]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_171]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_171]
I'm not entirely sure how this part of IRI works but @gjeee suggested it might be a multithreading issue here: https://github.com/iotaledger/iri/blob/12b46039b768e742c2e10343c24512718805172f/src/main/java/com/iota/iri/network/TCPNeighbor.java#L91
Hardware Spec
Google Cloud 4 vCPUs, 10GB RAM
Steps To Reproduce
Unknown
@Override
public void send(DatagramPacket packet) {
if (sendQueue.remainingCapacity() == 0) {
sendQueue.poll();
}
byte[] bytes = packet.getData().clone();
sendQueue.add(ByteBuffer.wrap(bytes));
}
well i am not sure but the sendQueue is a ArrayBlockingQueue with capacity of 10. i think the method needs a lock so that the poll() and add() are done synchronized, since three threads are calling this send method:
- spawnReplyToRequestThread:
replyToRequestFromQueue -> replyToRequest -> sendPacket -> neighbor.send(sendingPacket); - spawnTipRequesterThread:
neighbors.forEach(n -> n.send(tipRequestingPacket)); - spawnBroadcasterThread:
sendPacket -> neighbor.send(sendingPacket);
Same behavior (node not in sync, LSMI not increasing) but crash on the UDP-thread:
jul 04 21:34:40 iri[9348]: 07/04 21:34:40.991 [Latest Milestone Tracker] INFO com.iota.iri.Milestone - Latest milestone has changed from #576636 to #576637
jul 04 21:43:48 iri[9348]: Exception in thread "UDP receiving thread" Exception in thread "Latest Milestone Tracker" java.lang.OutOfMemoryError: GC overhead limit exceeded
jul 04 21:43:48 iri[9348]: at java.util.concurrent.AbstractExecutorService.newTaskFor(AbstractExecutorService.java:87)
jul 04 21:43:48 iri[9348]: at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:111)
jul 04 21:43:48 iri[9348]: at com.iota.iri.network.UDPReceiver.lambda$spawnReceiverThread$1(UDPReceiver.java:84)
jul 04 21:43:48 iri[9348]: at com.iota.iri.network.UDPReceiver$$Lambda$13/1164440413.run(Unknown Source)
jul 04 21:43:48 iri[9348]: at java.lang.Thread.run(Thread.java:748)
jul 04 21:43:48 iri[9348]: java.lang.OutOfMemoryError: GC overhead limit exceeded
jul 04 21:43:48 iri[9348]: 07/04 21:43:43.813 [pool-3-thread-2] INFO com.iota.iri.network.Node - toProcess = 1 , toBroadcast = 0 , toRequest = 375 , toReply = 1 / totalTransactions = 20887418
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.019 [XNIO-1 I/O-2] ERROR org.xnio.listener - XNIO001007: A channel event listener threw an exception
jul 04 21:43:49 iri[9348]: java.lang.OutOfMemoryError: GC overhead limit exceeded
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.119 [XNIO-1 I/O-2] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.124 [XNIO-1 I/O-2] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.194 [XNIO-1 I/O-2] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.204 [XNIO-1 I/O-4] ERROR org.xnio.listener - XNIO001007: A channel event listener threw an exception
jul 04 21:43:49 iri[9348]: java.lang.OutOfMemoryError: GC overhead limit exceeded
jul 04 21:43:49 iri[9348]: at sun.nio.ch.SelectorImpl.register(SelectorImpl.java:129) ~[na:1.8.0_172]
jul 04 21:43:49 iri[9348]: at java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:212) ~[na:1.8.0_172]
jul 04 21:43:49 iri[9348]: at java.nio.channels.SelectableChannel.register(SelectableChannel.java:280) ~[na:1.8.0_172]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.WorkerThread.registerChannel(WorkerThread.java:683) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.QueuedNioTcpServer.accept(QueuedNioTcpServer.java:394) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.QueuedNioTcpServer.accept(QueuedNioTcpServer.java:57) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:289) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:128) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:580) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: at org.xnio.nio.WorkerThread.run(WorkerThread.java:464) ~[iri-1.5.0.jar:na]
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.213 [XNIO-1 I/O-2] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.225 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.291 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.293 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.294 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.294 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.304 [XNIO-1 I/O-4] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:43:49 iri[9348]: 07/04 21:43:49.322 [XNIO-1 I/O-2] ERROR com.iota.iri.service.API - Lost connection to client - cannot send response
jul 04 21:44:01 iri[9348]: 07/04 21:44:01.724 [pool-3-thread-2] INFO com.iota.iri.network.Node - toProcess = 0 , toBroadcast = 0 , toRequest = 411 , toReply = 0 / totalTransactions = 20887487
Hardware 8 GB RAM, 4 CPU
java.lang.OutOfMemoryError: GC overhead limit exceeded
@TeeVeeEss that looks like it might be a different error. How much memory are you allocating to IRI?
@rajivshah3 was using the playbook line
ExecStart=/usr/bin/java -Xmx${JAVA_MEM} -Xms${JAVA_INIT_MEM} -Xmn${JAVA_HEAP_MEM} -Xss1024k -XX:InitiatingHeapOccupancyPercent=0 -XX:MaxMetaspaceSize=512m -XX:CodeCacheMinimumFreeSpace=100k -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:+UseCompressedOops -Djava.awt.headless=true -jar ...
with options: JAVA_MEM=5734m JAVA_INIT_MEM=1638m JAVA_HEAP_MEM=1638m
But now the simple ExecStart=/usr/bin/java -Djava.net.preferIPv4Stack=true -jar ...
@TeeVeeEss hmm. How much memory is on your machine? It might help to increase JAVA_MEM a bit
Hardware 8 GB RAM, 4 CPU
👍