Description
Under load with concurrent users making modifications to the hst configuration, exceptions like below happen.
The problem is that the HstNodeLoadingCache and HstConfigurationLoadingCache can since 13.0.0 be accessed concurrently. The reason is that before 13.0.0, every hst model part loading was synchronized via a global 'hstModelMutex' object (and also the lazily augmented parts like an HstSitemap and HstComponentsConfiguration). However, since 13.0.0, only some parts still use this webapp global 'hstModelMutex' since the 'hstModelMutex' comes from the cms platform, but other parts don't use the global 'hstModelMutex' resulting in concurrent access to the HstNodeLoadingCache and HstConfigurationLoadingCache
Still using this 'hstModelMutex' which is a object from the platform webapp doesn't make sense any more and is very error prone: Every object using HstNodeLoadingCache or HstConfigurationLoadingCache have to take the 'hstModelMutex' into account since HstNodeLoadingCache or HstConfigurationLoadingCache are not thread safe.
This should be changed. Instead of using 'hstModelMutex' for example like:
public HstComponentsConfiguration getComponentsConfiguration() { if (componentsConfiguration != null) { return componentsConfiguration.get(); } log.debug("Loading HstComponentsConfiguration for '{}'", configurationPath); synchronized (hstModelMutex) { if (componentsConfiguration != null) { return componentsConfiguration.get(); }
in HstSiteService, we can much better just synchronize on the HstSiteService instance itself AND make sure that HstNodeLoadingCache and HstConfigurationLoadingCache become thread-safe...which makes sense for a cache any way
04:51:53 [INFO] [talledLocalContainer] 04.03.2019 03:51:53 ERROR http-nio-8080-exec-7 [HstModelImpl.getVirtualHosts:258] Exception loading model
04:51:53 [INFO] [talledLocalContainer] java.lang.NullPointerException: null
04:51:53 [INFO] [talledLocalContainer] at org.hippoecm.hst.platform.configuration.cache.HstNodeLoadingCache.getNode(HstNodeLoadingCache.java:123) ~[hst-platform-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]
04:51:53 [INFO] [talledLocalContainer] at org.hippoecm.hst.platform.configuration.hosting.VirtualHostsService.quickModelCheck(VirtualHostsService.java:439) ~[hst-platform-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]
04:51:53 [INFO] [talledLocalContainer] at org.hippoecm.hst.platform.configuration.hosting.VirtualHostsService.<init>(VirtualHostsService.java:198) ~[hst-platform-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]
04:51:53 [INFO] [talledLocalContainer] at org.hippoecm.hst.platform.model.HstModelImpl.getVirtualHosts(HstModelImpl.java:228) [hst-platform-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]
04:51:53 [INFO] [talledLocalContainer] at org.hippoecm.hst.platform.services.BlueprintServiceImpl.getBlueprints(BlueprintServiceImpl.java:48) [hst-platform-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]
04:51:53 [INFO] [talledLocalContainer] at org.onehippo.cms7.channelmanager.channels.BlueprintStore.getBlueprints(BlueprintStore.java:101) [hippo-addon-channel-manager-frontend-13.1.0-SNAPSHOT.jar:13.1.0-SNAPSHOT]