[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 编码查看转换 | 代码下载 | 常见问题及讨论 | Python游戏编程讨论 | 《深入解析ASP核心技术》 | Python游戏编程教程 | AI图片生成
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]spring的getBean导致的程序卡顿

上一篇:[备忘]druid报错:connection holder is null或者connection closed
下一篇:[备忘]免费ai网站

添加日期:2025/8/18 16:37:37 快速返回   返回列表 阅读634次
多个请求卡顿300秒左右,线程dump发现如下内容:


"nioEventLoopGroup-2-1" Id=98 BLOCKED on java.util.concurrent.ConcurrentHashMap@4bce3407 owned by "ThreadPool-1-thread-9" Id=414
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:186)
    -  blocked on java.util.concurrent.ConcurrentHashMap@4bce3407
    at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:486)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:337)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)



ThreadPool-1-thread-9 正在连接https网址,实际上它连不上。
但是连接超时设置的高达100秒,导致一直在等待。

该线程实际是xxxx类的init()方法,该bean是懒加载,
所以调用时,spring需要getBean,先执行init方法,但是里面执行https请求,卡住,
spring的getBean是带同步锁定的,
所以后续的getBean都会被卡住,包括Controller里的注入,所以现象就是整体不可用。


 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved