You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/10/13 09:40:58 UTC

[Bug 64809] New: it's haven't reset connection properties based on connectionpool configuration information when returnConnection

https://bz.apache.org/bugzilla/show_bug.cgi?id=64809

            Bug ID: 64809
           Summary: it's  haven't reset connection properties based on
                    connectionpool configuration information when
                    returnConnection
           Product: Tomcat 8
           Version: 8.5.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: xiongchao90.1.11@163.com
  Target Milestone: ----

it's  haven't reset connection properties based on connectionpool configuration
information when returnConnection

Causes the connection pool properties to be confused

if A thread  connection A con.setReadOnly(true)
con.setAutoCommit(false),release connection A。

B thread get connection A execute update throws exception

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


[Bug 64809] Connection properties not reset to defaults when Connection is returned to the pool

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64809

--- Comment #2 from xiongchao <xi...@163.com> ---
 protected void returnConnection(PooledConnection con) {
        if (this.isClosed()) {
            this.release(con);
        } else {
            if (con != null) {
                try {
                    this.returnedCount.incrementAndGet();
                    con.lock();
                    if (con.isSuspect()) {
                        if (this.poolProperties.isLogAbandoned() &&
log.isInfoEnabled()) {
                            log.info("Connection(" + con + ") that has been
marked suspect was returned." + " The processing time is " +
(System.currentTimeMillis() - con.getTimestamp()) + " ms.");
                        }

                        if (this.jmxPool != null) {
                            this.jmxPool.notify("SUSPECT CONNECTION RETURNED",
"Connection(" + con + ") that has been marked suspect was returned.");
                        }
                    }

                    if (this.busy.remove(con)) {
                        if (!this.shouldClose(con, 2)) {
                            con.setStackTrace((String)null);
                            con.setTimestamp(System.currentTimeMillis());
                            if (this.idle.size() >=
this.poolProperties.getMaxIdle() && !this.poolProperties.isPoolSweeperEnabled()
|| !this.idle.offer(con)) {
                                if (log.isDebugEnabled()) {
                                    log.debug("Connection [" + con + "] will be
closed and not returned to the pool, idle[" + this.idle.size() + "]>=maxIdle["
+ this.poolProperties.getMaxIdle() + "] idle.offer failed.");
                                }

                                this.release(con);
                            }
                        } else {
                            if (log.isDebugEnabled()) {
                                log.debug("Connection [" + con + "] will be
closed and not returned to the pool.");
                            }

                            this.release(con);
                        }
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug("Connection [" + con + "] will be closed
and not returned to the pool, busy.remove failed.");
                        }

                        this.release(con);
                    }
                } finally {
                    con.unlock();
                }
            }

        }
    }

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


[Bug 64809] Connection properties not reset to defaults when Connection is returned to the pool

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64809

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|----                        |---
            Summary|it's  haven't reset         |Connection properties not
                   |connection properties based |reset to defaults when
                   |on connectionpool           |Connection is returned to
                   |configuration information   |the pool
                   |when returnConnection       |
            Version|8.5.11                      |unspecified
          Component|Connectors                  |jdbc-pool
            Product|Tomcat 8                    |Tomcat Modules

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Correcting product (I'm assuming jdbc-pool on the basis I've confirmed DBCP
does reset these properties)

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