我们有一个运行Infinispan 13.0.12高速缓存的Spring-Boot REST应用程序,我们看到了周期性的、看似随机的应用程序无响应的情况。线程转储表明有超过200个线程处于这种状态:
"http-nio-8080-exec-379" #11999 daemon prio=5 os_prio=0 tid=0x00007f28900f9800 nid=0x2c68
waiting on condition [0x00007f28485c2000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c09af3e8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163)
at org.jgroups.util.Credit.decrementIfEnoughCredits(Credit.java:65)
at org.jgroups.protocols.UFC.handleDownMessage(UFC.java:119)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:323)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:317)
at org.jgroups.protocols.FRAG3.down(FRAG3.java:139)
at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:927)
at org.jgroups.JChannel.down(JChannel.java:645)
at org.jgroups.JChannel.send(JChannel.java:484)
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.send(JGroupsTransport.java:1161)
我们的Java配置如下所示:
@Autowired
@Bean
public SpringEmbeddedCacheManagerFactoryBean springEmbeddedCacheManagerFactoryBean(GlobalConfigurationBuilder gcb, ConfigurationBuilder configurationBuilder) {
SpringEmbeddedCacheManagerFactoryBean springEmbeddedCacheManagerFactoryBean = new SpringEmbeddedCacheManagerFactoryBean();
springEmbeddedCacheManagerFactoryBean.addCustomGlobalConfiguration(gcb);
springEmbeddedCacheManagerFactoryBean.addCustomCacheConfiguration(configurationBuilder);
return springEmbeddedCacheManagerFactoryBean;
}
@Autowired
@Bean
public EmbeddedCacheManager defaultCacheManager(SpringEmbeddedCacheManager springEmbeddedCacheManager) throws Exception {
return springEmbeddedCacheManager.getNativeCacheManager();
}
@Bean
public GlobalConfigurationBuilder globalConfigurationBuilder() {
GlobalConfigurationBuilder result = GlobalConfigurationBuilder.defaultClusteredBuilder();
result.transport().addProperty("configurationFile", jgroupsConfigFile);
result.cacheManagerName(IDENTITY_CACHE);
result.defaultCacheName(IDENTITY_CACHE + "-default");
result.serialization()
.marshaller(new JavaSerializationMarshaller())
.allowList()
.addClasses(
LinkedMultiValueMap.class,
String.class
);
result.globalState().enable().persistentLocation(DATA_DIR);
return result;
}
@Bean
public ConfigurationBuilder configurationBuilder() {
ConfigurationBuilder result = new ConfigurationBuilder();
result.clustering().cacheMode(CacheMode.REPL_SYNC);
return result;
}
@Bean
public org.infinispan.configuration.cache.Configuration cacheConfiguration() {
ConfigurationBuilder builder = new ConfigurationBuilder();
return builder
.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.remoteTimeout(replicationTimeoutSeconds, TimeUnit.SECONDS)
.stateTransfer().timeout(stateTransferTimeoutMinutes, TimeUnit.MINUTES)
.persistence()
.addSoftIndexFileStore()
.shared(false)
.fetchPersistentState(true)
.expiration().lifespan(expirationHours, TimeUnit.HOURS)
.build();
}
@Autowired
@Bean
public Cache<String, MultiValueMap<String, String>> identityCache(EmbeddedCacheManager manager, org.infinispan.configuration.cache.Configuration cacheConfiguration) throws IOException {
Cache<String, MultiValueMap<String, String>> result = manager
.administration().withFlags(CacheContainerAdmin.AdminFlag.VOLATILE)
.getOrCreateCache(IDENTITY_CACHE, cacheConfiguration);
result.getAdvancedCache().getStats().setStatisticsEnabled(true);
return result;
}
并且我们使用default-jgroups-udp.xml配置运行一个三节点集群。有人能提出一个可能的原因吗?也许配置不是最佳的?
短暂性脑缺血
2条答案
按热度按时间cbeh67ev1#
您有复制的快取。这表示读取永远是本机的,所以堆栈追踪必须在写入(或重新平衡)时。
阻塞意味着发送方正在等待来自接收方的信用,信用没有到达,所以接收方一定被困在某事中。你能显示整个轨迹吗?
要知道这是怎么回事,这将是很好的看到线程转储的 * 所有 * 成员。我建议压缩他们,并张贴链接到压缩在这里...干杯
enyaitl32#
这会不会与https://issues.redhat.com/browse/ISPN-14260有关?
您是否正在使用ACL缓存授权?
我们的临时修复是禁用缓存授权,这解决了我们所有的锁定问题。等待13和14的补丁完成