Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] spring-authorization-server整合druid,作为链接池,在并发情况下访问/oauth2/token获取token时出现阻塞问题 #6250

Open
ct1561 opened this issue Nov 25, 2024 · 1 comment

Comments

@ct1561
Copy link

ct1561 commented Nov 25, 2024

Database Type

MySQL

Database Version

MySQL 8.0.23

Druid Version

1.2.20

JDK Version

OpenJDK17

Error SQL

Testcase Code

max-active:5
max-wait: 60000
test-on-borrow: false
test-on-return: false
keep-alive: true
test-while-idle: false
min-idle: 3
remove-abandoned: false

若是访问/oauth2/token的并发数超过最大链接数,则会出现阻塞情况,链接池中的连接全被占用,且不会释放;
当时druid监控的画面如图所示;
Uploading 微信截图_20241125091930.png…

Stacktrace Info

No response

Error Info

通过java监控控制台发现,阻塞的进程都在DruidDataSource的getConnectionDirect方法中

java.base/java.lang.Thread.getStackTrace(Thread.java:1621)
com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1562)
com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5058)
com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2759)
com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5054)
com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:704)
com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5054)
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1468)
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1458)
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:83)
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:211)
jdk.internal.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

@ct1561
Copy link
Author

ct1561 commented Nov 25, 2024

@wenshao 老师这可能是哪方面的问题造成的呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant