Repository: Giskard-AI/giskard-oss
Issue: [GSK-858] Hikari connections leak
GitHub labels: bug

Sometimes Giskard server becomes unresponsive with the following stack trace

```
giskard-demo-backend-1  | org.springframework.transaction.TransactionSystemException: Could not roll back JPA transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
giskard-demo-backend-1  | 	at org.springframework.orm.jpa.JpaTransactionManager.doRollback(JpaTransactionManager.java:593)
giskard-demo-backend-1  | 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:835)
giskard-demo-backend-1  | 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:809)
giskard-demo-backend-1  | 	at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:672)
giskard-demo-backend-1  | 	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392)
giskard-demo-backend-1  | 	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
giskard-demo-backend-1  | 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
giskard-demo-backend-1  | 	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
giskard-demo-backend-1  | 	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
giskard-demo-backend-1  | 	at ai.giskard.web.rest.controllers.SettingsController$$EnhancerBySpringCGLIB$$2200e460.getApplicationSettings(<generated>)
giskard-demo-backend-1  | 	at jdk.internal.reflect.GeneratedMethodAccessor309.invoke(Unknown Source)
giskard-demo-backend-1  | 	at java.base/jdk.internal.reflect.DelegatingMethodAccesshiorImpl.invoke(Unknown Source)
giskard-demo-backend-1  | 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
giskard-demo-backend-1  | 	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
giskard-demo-backend-1  | 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1070)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
giskard-demo-backend-1  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
giskard-demo-backend-1  | 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:111)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:111)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java:67)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
giskard-demo-backend-1  | 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
giskard-demo-backend-1  | 	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
giskard-demo-backend-1  | 	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
giskard-demo-backend-1  | 	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:150)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at ai.giskard.security.jwt.JWTFilter.doFilter(JWTFilter.java:38)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
giskard-demo-backend-1  | 	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at ai.giskard.config.FilterChainExceptionHandler.doFilterInternal(FilterChainExceptionHandler.java:30)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
giskard-demo-backend-1  | 	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
giskard-demo-backend-1  | 	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
giskard-demo-backend-1  | 	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
giskard-demo-backend-1  | 	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
giskard-demo-backend-1  | 	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
giskard-demo-backend-1  | 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
giskard-demo-backend-1  | 	at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
giskard-demo-backend-1  | 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
giskard-demo-backend-1  | 	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
giskard-demo-backend-1  | 	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
giskard-demo-backend-1  | 	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
giskard-demo-backend-1  | 	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
giskard-demo-backend-1  | 	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
```

reported by XHR and AIshepherds

<sub>From [SyncLinear.com](https://synclinear.com) | [GSK-858](https://linear.app/giskard/issue/GSK-858/hikari-connections-leak)</sub>

@andreybavt Could you please provide the steps to reproduce this

Hi @Khushiyant , this issue should be fixed by now and will be released in the coming weeks, thanks for the interest