esanchezros / quickfixj-spring-boot-starter

Spring Boot Starter for QuickFIX/J
Apache License 2.0
125 stars 57 forks source link

ConcurrentModificationException in QuickFixJSessionHealthIndicator #111

Closed dafriz closed 1 year ago

dafriz commented 1 year ago

When starting up a multiple FIX session service we get ConcurrentModificationExceptions logged, stack trace below

SB: 2.7.14 QF-SBS: 2.15.4

java.util.ConcurrentModificationException: null
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221)
at io.allune.quickfixj.spring.boot.actuate.health.QuickFixJSessionHealthIndicator.lambda$doHealthCheck$1(QuickFixJSessionHealthIndicator.java:55)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
at io.allune.quickfixj.spring.boot.actuate.health.QuickFixJSessionHealthIndicator.doHealthCheck(QuickFixJSessionHealthIndicator.java:53)
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82)

Should sessionScheduleMap be changed to a ConcurrentHashMap?

esanchezros commented 1 year ago

Hey @dafriz, thanks for reporting this issue. In this case it seems like the sessionID could not be found on the session schedule factory and a null sessionSchedule was used to modify the map producing the ConcurrentModificationException. I will try to make the change but if you want to send a PR it will be much appreciated. Thanks

esanchezros commented 1 year ago

I've fixed this issue, will try to release a new version this week. Thanks for reporting @dafriz