sam-tsai / activejdbc

Automatically exported from code.google.com/p/activejdbc
0 stars 0 forks source link

DB connection leak caused by duplicated DB Connection Filter for controller #150

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Define two DB connection filter for the same page

add(new DBConnectionFilter("default")).to(MyController.class);
add(new DBConnectionFilter("default")).to(MyController.class);

2. Hit MyController page - > get ActiveJDBC exeption: "You are opening a 
connection defaut without closing a previous one."
3. In this point we have one connection leak 
4. Any other access to MyController page will cause one more leak in connection 
pool unless connections leaks count less that N-1 where N is pool size

Finally we have N-1 connections leaks in the pool and it breaks application in 
concurrent environment

Attached sample project to reproduce the issue.

Original issue reported on code.google.com by amarkavt...@gmail.com on 2 Apr 2012 at 9:18

Attachments:

GoogleCodeExporter commented 8 years ago
this is really caused by registering two connections on the same action in the 
controller. 

Original comment by ipolevoy@gmail.com on 2 Apr 2012 at 9:19

GoogleCodeExporter commented 8 years ago

Original comment by ipolevoy@gmail.com on 2 Apr 2012 at 9:44