minima-global / Minima

The Minima protocol Java libraries and application
Apache License 2.0
129 stars 146 forks source link

ArrayIndexOutOfBoundsException & NullPointerException during message processing in TimerProcessor.java #552

Closed DShaurin closed 2 years ago

DShaurin commented 2 years ago

Due to concurrency issue with mTimerMessages object swap with newList, while another thread is waiting inside PostMessage call, ArrayIndexOutOfBoundsException & NullPointerException are fired. Execution stops after that.

Minima @ 18/02/2022 08:42:38 [82.8 MB] : [+] Setting My IP: 15.21.26.231 Minima @ 18/02/2022 08:42:39 [82.8 MB] : [+] Connected to the blockchain Initial Block Download received. size:5 bytes blocks:0 Minima @ 18/02/2022 08:42:48 [83.8 MB] : Warning : Attempting to connect to already connected host 25.15.23.153:9001 Minima @ 18/02/2022 09:08:11 [203.3 MB] : [+] Connected to the blockchain Initial Block Download received. size:5 bytes blocks:0 Minima @ 18/02/2022 09:41:54 [72.9 MB] : MESSAGE PROCESSING ERROR @ MAIN_PULSE Minima @ 18/02/2022 09:41:54 [72.9 MB] : java.lang.ArrayIndexOutOfBoundsException: 10 Minima @ 18/02/2022 09:41:54 [76.0 MB] : java.util.ArrayList.add(Unknown Source) Minima @ 18/02/2022 09:41:54 [76.0 MB] : org.minima.utils.messages.TimerProcessor.PostMessage(TimerProcessor.java:51) Minima @ 18/02/2022 09:41:54 [76.0 MB] : org.minima.utils.messages.MessageProcessor.PostTimerMessage(MessageProcessor.java:83) Minima @ 18/02/2022 09:41:54 [76.0 MB] : org.minima.system.Main.processMessage(Main.java:410) Minima @ 18/02/2022 09:41:54 [76.0 MB] : org.minima.utils.messages.MessageProcessor.run(MessageProcessor.java:106) Minima @ 18/02/2022 09:41:54 [76.0 MB] : java.lang.Thread.run(Unknown Source) Exception in thread "Thread-1" java.lang.NullPointerException at org.minima.utils.messages.TimerProcessor.run(TimerProcessor.java:70) at java.lang.Thread.run(Unknown Source)

Moved changes from master to dev branch based in this PR https://github.com/minima-global/Minima/pull/551