After having network issues between my Grails app and the Postgres DB on AWS, JDBC connections needed to be recreated by Tomcat. It did so, but then my app would somewhat end up with connections that are closed when executing transactions afterward.
After a long investigation, the issue was not happening when removing the JavaMelody plugin from my app. So I dug a bit to find what was happening and saw that the SpringDataSourceBeanPostProcessor was proxying three DataSources (dataSourceUnproxied, dataSourceLazy and dataSource).
I tried configuring it to only proxy one of them. By proxying dataSourceUnproxied, JDBC queries are still monitored by JavaMelody and when connections are recreated by Tomcat everything seems to be working as expected.
I suggest we add "dataSourceLazy" and "dataSource" in the excluded list of proxyed datasource in GrailsMelodyPluginGrailsPlugin or at least write some documentation about configuration of the plugin with Tomcat (default Grails configuration).
I have a pull-request with this "fix". Tell me what you think about this issue / fix.
After having network issues between my Grails app and the Postgres DB on AWS, JDBC connections needed to be recreated by Tomcat. It did so, but then my app would somewhat end up with connections that are closed when executing transactions afterward.
After a long investigation, the issue was not happening when removing the JavaMelody plugin from my app. So I dug a bit to find what was happening and saw that the SpringDataSourceBeanPostProcessor was proxying three DataSources (dataSourceUnproxied, dataSourceLazy and dataSource).
I tried configuring it to only proxy one of them. By proxying dataSourceUnproxied, JDBC queries are still monitored by JavaMelody and when connections are recreated by Tomcat everything seems to be working as expected.
I suggest we add "dataSourceLazy" and "dataSource" in the excluded list of proxyed datasource in GrailsMelodyPluginGrailsPlugin or at least write some documentation about configuration of the plugin with Tomcat (default Grails configuration).
I have a pull-request with this "fix". Tell me what you think about this issue / fix.
Thanks.