C-Otto / lnd-manageJ

MIT License
52 stars 11 forks source link

Bug: Duplicate key causes dashboard to fail with Internal Server Error #68

Closed martinatime closed 2 years ago

martinatime commented 2 years ago

Describe the bug My node has two channels open to AliensTech. When I first started lnd-manageJ (I'm guessing before it had loaded any data) the dashboard loaded fine. I clicked on Channels and Nodes and those worked correctly. When I went back to the Dashboard, or clicked went to the base url, or clicked on the lnd-manageJ in the top left corner it returns an Internal Server Error

To Reproduce Which commands did you run to reproduce this? I think this is due to having two channels to the same node

Expected behavior Standard behavior

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Using start-H2.sh while I test this out

Here is the stacktrace 2022-09-10 10:48:11,723 ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: java.lang.IllegalStateException: Duplicate key AliensTech (attempted merging values NodeWarnings[warnings=[NodeRatingWarning[rating=815, threshold=1000]]] and NodeWarnings[warnings=[NodeRatingWarning[rating=815, threshold=1000]]])] with root causejava.lang.IllegalStateException: Duplicate key AliensTech (attempted merging values NodeWarnings[warnings=[NodeRatingWarning[rating=815, threshold=1000]]] and NodeWarnings[warnings=[NodeRatingWarning[rating=815, threshold=1000]]]) at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135) ~[na:na] at java.base/java.util.stream.Collectors.lambda$uniqKeysMapMerger$0(Collectors.java:157) ~[na:na] at java.base/java.util.stream.ReduceOps$3ReducingSink.combine(ReduceOps.java:174) ~[na:na] at java.base/java.util.stream.ReduceOps$3ReducingSink.combine(ReduceOps.java:160) ~[na:na] at java.base/java.util.stream.ReduceOps$ReduceTask.onCompletion(ReduceOps.java:967) ~[na:na] at java.base/java.util.concurrent.CountedCompleter.tryComplete(CountedCompleter.java:597) ~[na:na] at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:328) ~[na:na] at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754) ~[na:na] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[na:na] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[na:na]

martinatime commented 2 years ago

I installed and configured Postgres and was able to duplicated the issue using the start.sh script as well.

When initially starting the dashboard loads fine but after clicking around for a bit (a minute or two) and returning to the dashboard it returns the same Internal Server Error and the stack trace from above.

martinatime commented 2 years ago

A little more investigation and I have narrowed the issue down to /api/warnings . I'll keep looking

martinatime commented 2 years ago

I figured out the issue and tested a fix. Now I need to figure out how to contribute. Stay tuned

C-Otto commented 2 years ago

Thank you for the report!