[Bug 61425] all idle connections become ' in transaction' when the 'testWhileIdle' is set to 'true' and 'defaultAutoCommit' is set to 'false'

2017-08-23 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61425

Keiichi Fujino  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #5 from Keiichi Fujino  ---
Thanks for the patch.
The fix will be in :
- 9.0.x for 9.0.0.M27 onwards
- 8.5.x for 8.5.21 onwards
- 8.0.x for 8.0.47 onwards
- 7.0.x for 7.0.82 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61425] all idle connections become ' in transaction' when the 'testWhileIdle' is set to 'true' and 'defaultAutoCommit' is set to 'false'

2017-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61425

--- Comment #4 from WangZheng  ---
admin=# select current_query from pg_stat_activity where usename='admin';
 current_query 
---
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
  in transaction
(15 rows)

The above is queried the database.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61425] all idle connections become ' in transaction' when the 'testWhileIdle' is set to 'true' and 'defaultAutoCommit' is set to 'false'

2017-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61425

--- Comment #3 from WangZheng  ---
Created attachment 35233
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35233=edit
use this patch instead

Sorry, there are some mistakes in the previous patch, please use one instead.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61425] all idle connections become ' in transaction' when the 'testWhileIdle' is set to 'true' and 'defaultAutoCommit' is set to 'false'

2017-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61425

--- Comment #2 from WangZheng  ---
Comment on attachment 35232
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35232
Attaching a simple patch to commit/rollback the connection.

diff --git a/org/apache/tomcat/jdbc/pool/PooledConnection.java
b/org/apache/tomcat/jdbc/pool/PooledConnection.java
index c833209..4615abf 100644
--- a/org/apache/tomcat/jdbc/pool/PooledConnection.java
+++ b/org/apache/tomcat/jdbc/pool/PooledConnection.java
@@ -541,6 +541,22 @@ public class PooledConnection {
 }
 if (stmt!=null)
 try { stmt.close();} catch (Exception ignore2){/*NOOP*/}
+
+try {
+if(!connection.getAutoCommit()) {
+connection.rollback();
+}
+} catch (SQLException e) {
+// do nothing
+}
+} finally {
+try {
+if(!connection.getAutoCommit()) {
+connection.commit();
+}
+} catch (SQLException e) {
+// do nothing
+}
 }
 return false;
 } //validate

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61425] all idle connections become ' in transaction' when the 'testWhileIdle' is set to 'true' and 'defaultAutoCommit' is set to 'false'

2017-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61425

--- Comment #1 from WangZheng  ---
Created attachment 35232
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35232=edit
Attaching a simple patch to commit/rollback the connection.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org