2017-05-22 68 views
0

我運行在WebSphere服務器自由春季啓動應用程序(16.0.0.4版)。在單一的自由實例上運行springboot應用程序的戰爭更多。彈簧庫版本我們是春季啓動鎖死與WebSphere自由的類加載器

  1. 彈簧芯 - 4.3.2.RELEASE
  2. org.springframework.cloud - Brixton.SR5
  3. org.springframework.boot - 1.4.0.RELEASE

以下是死鎖的堆棧跟蹤

請您幫助我們瞭解可能存在什麼潛在問題?

Owns Monitor Lock on com/ibm/ws/classloading/internal/[email protected] 
Waiting for Monitor Lock on com/ibm/ws/classloading/internal/[email protected] 
at java/lang/ClassLoader.loadClass(ClassLoader.java:805(Compiled Code)) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader.findClass(UnifiedClassLoader.java:116(Compiled Code)) 
at java/lang/ClassLoader.loadClassHelper(ClassLoader.java:846(Compiled Code)) 
at java/lang/ClassLoader.loadClass(ClassLoader.java:825(Compiled Code)) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader.loadClass0(UnifiedClassLoader.java:108) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader$Delegation.loadClass(UnifiedClassLoader.java:79) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader.loadClass(UnifiedClassLoader.java:103) 
at com/ibm/ws/classloading/internal/ThreadContextClassLoader.loadClass(ThreadContextClassLoader.java:112) 
at java/lang/ClassLoader.loadClass(ClassLoader.java:805(Compiled Code)) 
at java/util/ResourceBundle$Control.newBundle(ResourceBundle.java:2666) 
at java/util/ResourceBundle.loadBundle(ResourceBundle.java:1527(Compiled Code)) 
at java/util/ResourceBundle.findBundle(ResourceBundle.java:1491(Compiled Code)) 
at java/util/ResourceBundle.findBundle(ResourceBundle.java:1445(Compiled Code)) 
at java/util/ResourceBundle.getBundleImpl(ResourceBundle.java:1380(Compiled Code)) 
at java/util/ResourceBundle.getBundle(ResourceBundle.java:1093) 
at org/apache/bval/jsr/DefaultMessageInterpolator.loadBundle(DefaultMessageInterpolator.java:200) 
at org/apache/bval/jsr/DefaultMessageInterpolator.getFileBasedResourceBundle(DefaultMessageInterpolator.java:177) 
at org/apache/bval/jsr/DefaultMessageInterpolator.findUserResourceBundle(DefaultMessageInterpolator.java:283) 
at org/apache/bval/jsr/DefaultMessageInterpolator.(DefaultMessageInterpolator.java:82) 
at org/apache/bval/jsr/DefaultMessageInterpolator.(DefaultMessageInterpolator.java:69) 
at org/apache/bval/jsr/ConfigurationImpl.(ConfigurationImpl.java:77) 
at org/apache/bval/jsr/ApacheValidationProvider.createGenericConfiguration(ApacheValidationProvider.java:63) 
at javax/validation/Validation$GenericBootstrapImpl.configure(Validation.java:164) 
at org/springframework/boot/autoconfigure/BackgroundPreinitializer$ValidationInitializer.run(BackgroundPreinitializer.java:107) 
at org/springframework/boot/autoconfigure/BackgroundPreinitializer$1.runSafely(BackgroundPreinitializer.java:59) 
at org/springframework/boot/autoconfigure/BackgroundPreinitializer$1.run(BackgroundPreinitializer.java:52) 
at java/lang/Thread.run(Thread.java:785) 

------------------------------------------ 

Owns Monitor Lock on com/ibm/ws/classloading/internal/[email protected] 
Waiting for Monitor Lock on com/ibm/ws/classloading/internal/[email protected] 

at java/lang/ClassLoader.loadClass(ClassLoader.java:824(Compiled Code)) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader.loadClass0(UnifiedClassLoader.java:108) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader$Delegation.loadClass(UnifiedClassLoader.java:79) 
at com/ibm/ws/classloading/internal/UnifiedClassLoader.loadClass(UnifiedClassLoader.java:103) 
at com/ibm/ws/classloading/internal/ThreadContextClassLoader.loadClass(ThreadContextClassLoader.java:112) 
at java/lang/ClassLoader.loadClass(ClassLoader.java:805(Compiled Code)) 
at org/apache/logging/log4j/util/LoaderUtil.loadClass(LoaderUtil.java:120) 
at org/apache/logging/slf4j/Log4jLogger.createConverter(Log4jLogger.java:416) 
at org/apache/logging/slf4j/Log4jLogger.(Log4jLogger.java:54) 
at org/apache/logging/slf4j/Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37) 
at org/apache/logging/slf4j/Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29) 
at org/apache/logging/log4j/spi/AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48) 
at org/apache/logging/slf4j/Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) 
at org/slf4j/LoggerFactory.getLogger(LoggerFactory.java:358) 
at org/apache/commons/logging/impl/SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155) 
at org/apache/commons/logging/impl/SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132) 
at org/apache/commons/logging/LogFactory.getLog(LogFactory.java:685) 
at org/springframework/cloud/bootstrap/config/PropertySourceBootstrapConfiguration.(PropertySourceBootstrapConfiguration.java:63) 
at java/lang/Class.forNameImpl(Native Method) 
at java/lang/Class.forName(Class.java:348(Compiled Code)) 
at org/springframework/cglib/core/ReflectUtils.defineClass(ReflectUtils.java:415) 
at org/springframework/cglib/core/AbstractClassGenerator.generate(AbstractClassGenerator.java:336) 
at org/springframework/cglib/proxy/Enhancer.generate(Enhancer.java:492) 
at org/springframework/cglib/core/AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) 
at org/springframework/cglib/core/AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) 
at org/springframework/cglib/core/internal/LoadingCache$2.call(LoadingCache.java:54) 
at java/util/concurrent/FutureTask.run(FutureTask.java:277(Compiled Code)) 
at org/springframework/cglib/core/internal/LoadingCache.createEntry(LoadingCache.java:61) 
at org/springframework/cglib/core/internal/LoadingCache.get(LoadingCache.java:34) 
at org/springframework/cglib/core/AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) 
at org/springframework/cglib/core/AbstractClassGenerator.create(AbstractClassGenerator.java:291) 
at org/springframework/cglib/proxy/Enhancer.createHelper(Enhancer.java:480) 
at org/springframework/cglib/proxy/Enhancer.createClass(Enhancer.java:337) 
at org/springframework/context/annotation/ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:135) 
at org/springframework/context/annotation/ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:107) 
at org/springframework/context/annotation/ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:406) 
at org/springframework/context/annotation/ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263) 
at org/springframework/context/support/PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284) 
at org/springframework/context/support/PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130) 
at org/springframework/context/support/AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681) 
at org/springframework/context/support/AbstractApplicationContext.refresh(AbstractApplicationContext.java:523) 
at org/springframework/boot/SpringApplication.refresh(SpringApplication.java:759) 
at org/springframework/boot/SpringApplication.refreshContext(SpringApplication.java:369) 
at org/springframework/boot/SpringApplication.run(SpringApplication.java:313) 
at org/springframework/boot/builder/SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) 
at org/springframework/cloud/bootstrap/BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:140) 
at org/springframework/cloud/bootstrap/BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84) 
at org/springframework/cloud/bootstrap/BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:62) 
at org/springframework/context/event/SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) 
at org/springframework/context/event/SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) 
at org/springframework/context/event/SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121) 
at org/springframework/boot/context/event/EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:68) 
at org/springframework/boot/SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) 
at org/springframework/boot/SpringApplication.prepareEnvironment(SpringApplication.java:335) 
at org/springframework/boot/SpringApplication.run(SpringApplication.java:307) 
at org/springframework/boot/web/support/SpringBootServletInitializer.run(SpringBootServletInitializer.java:150) 
at org/springframework/boot/web/support/SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:130) 
at org/springframework/boot/web/support/SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86) 
at org/springframework/web/SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169) 
at com/ibm/ws/webcontainer/webapp/WebApp.initializeServletContainerInitializers(WebApp.java:2523) 
at com/ibm/ws/webcontainer/webapp/WebApp.initialize(WebApp.java:1054) 
at com/ibm/ws/webcontainer/webapp/WebApp.initialize(WebApp.java:6562) 
at com/ibm/ws/webcontainer/osgi/DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:468) 
at com/ibm/ws/webcontainer/osgi/DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:463) 
at com/ibm/ws/webcontainer/osgi/WebContainer.startWebApplication(WebContainer.java:1004) 
at com/ibm/ws/webcontainer/osgi/WebContainer.startModule(WebContainer.java:825) 
at com/ibm/ws/app/manager/module/internal/ModuleHandlerBase.deployModule(ModuleHandlerBase.java:100) 
at com/ibm/ws/app/manager/module/internal/DeployedModuleInfoImpl.installModule(DeployedModuleInfoImpl.java:50) 
at com/ibm/ws/app/manager/module/internal/DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:420) 
at com/ibm/ws/app/manager/module/internal/DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:406) 
at com/ibm/ws/app/manager/war/internal/WARApplicationHandlerImpl.install(WARApplicationHandlerImpl.java:66) 
at com/ibm/ws/app/manager/internal/statemachine/StartAction.execute(StartAction.java:141) 
at com/ibm/ws/app/manager/internal/statemachine/ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1191) 
at com/ibm/ws/app/manager/internal/statemachine/ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:804) 
at java/util/concurrent/ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153(Compiled Code)) 
at java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
at java/lang/Thread.run(Thread.java:785) 

+0

這看起來與您昨天發佈的問題完全相同:https://stackoverflow.com/questions/44103280/multiple-war-in-single-liberty-profile。你能否把其中一個關閉?否則,我們可能會隨機關閉其中一個 –

+0

是的,我刪除了它。 – vinothM

+0

你有沒有Javacore的僵局?這將提供JVM狀態的更完整圖像,並讓我們知道正在運行哪個Java版本。不同的J9版本之間的類鎖加密方式已經改變。 –

回答

1

兩個堆棧跟蹤是非常有用的信息 - 感謝。

第一堆棧跟蹤對我來說很有意義。所述ThreadContextClassLoader被委託給AppClassLoader,這也是正確的操作順序,因此在其中的鎖應當獲得正確的順序。

第二堆棧跟蹤讓我有些困惑。我看不到任何明顯擁有AppClassLoader顯示器的條目。我已經授予與同事,而最有可能的情況是,Class.forName()被傳遞的AppClassLoader和本地Class.forNameImpl()方法持有該裝載機顯示器。當被初始化的類(PropertySourceBootstrapConfiguration)通過apache日誌記錄來初始化另一個類時,這隻會成爲一個問題,該apache日誌記錄使用從線程上下文獲取的加載器加載。

如果Springboot是使用類加載器的線程上下文,而不是從Class.getClassLoader()由此得到的裝載機可能會阻止這個問題發生。 Springboot不能假定它在一個容器中運行,但它至少可以在嘗試Class.getClassLoader()之前首先查找線程上下文類加載器。

避免這種死鎖的一種可能的方法是將Springboot類分離到它們自己的庫中,並將其作爲應用程序配置中的公共庫引用。看看this Knowledge Center article中的步驟1-4。這應該意味着第二個線程的堆棧會鎖定庫類加載器而不是應用程序類加載器。這並不能保證避免死鎖,因爲排序仍然是意想不到的,但它可能使其不太可能發生(取決於此場景中的第一個線程正在加載以及與其他線程重合的原因)。

+0

謝謝,我會盡力回覆你 – vinothM