Affects Version/s: Master
Component/s: Core Infrastructure
After we made MultiVMPoolUtil wait for real service (see https://github.com/liferay/liferay-portal/commit/d2d4a1b29b2df0ba449963f873d55f0dba710b5b), it is possible that deadlock comes up while shutting down, see deadlock-threaddump.txt.
The solution is to switch the order of closing module framework and spring context, so that the real service is existed for sure when spring context is closing. MultiVMPoolUtil is only one of those Util who waits for real service, it is possible that other usages cause deadlock too, so we choose this solution in order to fix all the potential bugs.
Steps to reproduce:
1) Set break point at MultiVMEhcachePortalCacheManager.deactivate() and LAST Line of AssetCategoryPersistenceImpl.destroy().
2) Start port in debug mode and connect to debugger
3) Shutdown portal and wait for two break points are hit
4) Let AssetCategoryPersistenceImpl.destroy() process and you will be deadlocked
After fix, two break points won't be hit at the the same time.