jtrfp / terminal-recall

Engine remake for Terminal Velocity and Fury3
Eclipse Public License 1.0
56 stars 2 forks source link

RuntimeException: Redundant add : ... #270

Closed cjritola closed 2 years ago

cjritola commented 2 years ago

Following recent fixes to CollectionActionDispatcher.equals(...) a RuntimeException is frequently thrown in the log. This is a side effect of the previous fix enabling another pre-existing bug to be caught and mitigated. This averts a possible reference leak which could eventually slow the engine down with repeated scene changes, such as entry in/out of a tunnel, changing levels, or switching between views. The downside is there is now a lot of spam in the log. Will attempt to isolate an fix root cause, or temporarily silence the exception if the cause cannot be pinned down promptly.

java.lang.RuntimeException: Redundant add: org.jtrfp.trcl.coll.CollectionThreadDecoupler@569f8f41 at org.jtrfp.trcl.coll.CollectionActionDispatcher.addTarget(CollectionActionDispatcher.java:50) at org.jtrfp.trcl.coll.CollectionActionUnpacker.add(CollectionActionUnpacker.java:31) at org.jtrfp.trcl.coll.CollectionActionUnpacker.add(CollectionActionUnpacker.java:1) at com.ochafik.util.CollectionAdapter.add(CollectionAdapter.java:48) at org.jtrfp.trcl.coll.CollectionThreadDecoupler$1.run(CollectionThreadDecoupler.java:41) at org.jtrfp.trcl.TracingExecutor$TracingRunnable.run(TracingExecutor.java:51) at org.jtrfp.trcl.VerboseExecutorService$VerboseRunnable.run(VerboseExecutorService.java:159) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Submitted by the following trace: org.jtrfp.trcl.TracingExecutor$PreemptiveException at org.jtrfp.trcl.TracingExecutor.execute(TracingExecutor.java:34) at org.jtrfp.trcl.coll.CollectionThreadDecoupler.add(CollectionThreadDecoupler.java:38) at org.jtrfp.trcl.coll.CollectionActionDispatcher.add(CollectionActionDispatcher.java:74) at com.ochafik.util.listenable.AdaptedCollection.add(AdaptedCollection.java:104) at org.apache.commons.collections4.collection.PredicatedCollection.add(PredicatedCollection.java:160) at org.jtrfp.trcl.coll.CollectionActionDispatcher.add(CollectionActionDispatcher.java:74) at org.jtrfp.trcl.coll.CollectionActionDispatcher.add(CollectionActionDispatcher.java:74) at org.jtrfp.trcl.coll.CollectionActionPacker.add(CollectionActionPacker.java:52) at org.jtrfp.trcl.coll.CollectionActionPacker.add(CollectionActionPacker.java:1) at org.jtrfp.trcl.coll.PropertyBasedTagger$1$1.run(PropertyBasedTagger.java:198) at org.jtrfp.trcl.VerboseExecutorService$VerboseRunnable.run(VerboseExecutorService.java:159) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

cjritola commented 2 years ago

This hypothesis is not correct, as the target checking is based on an identity hash set, meaning the recent change to equals() really is resulting in redundant targets being added.