[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-dev
Subject:    a DBConnectionManager bug?
From:       Eric Li <ELi () commercehub ! com>
Date:       2004-03-29 16:57:20
Message-ID: OFDE37B664.36063C6F-ON85256E66.005CA05E-85256E66.005D8E27 () commercehub ! com
[Download RAW message or body]





I can not continues reproduce this problem, but I do observe it couple of
times:

java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:762)
        at java.util.HashMap$KeyIterator.next(HashMap.java:798)
        at
org.apache.jmeter.protocol.jdbc.util.DBConnectionManager.shutdown(DBConnectionManager.java:157)
        at
org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.testEnded(JDBCSampler.java:303)
        at
org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:165)
        at
org.apache.jmeter.engine.StandardJMeterEngine$StopTest.run(StandardJMeterEngine.java:220)
        at java.lang.Thread.run(Thread.java:536)

as I inspected the source code on DBConnectionManager:

    public void shutdown()
    {
      log.debug("Running shutdown from "+Thread.currentThread().getName());
      synchronized (poolMap)
      {
                  Iterator iter = poolMap.keySet().iterator();
                  while (iter.hasNext())
                  {
                  DBKey key = (DBKey)iter.next();
                      ConnectionPool pool = (ConnectionPool)
poolMap.remove(key);
                  pool.close();
                  }
      }
    }

    it is removing a object when there is an active iterator on the
map..... probabely it could be changed as:

public void shutdown()
    {
      log.debug("Running shutdown from "+Thread.currentThread().getName());
      synchronized (poolMap)
      {
                  Iterator iter = poolMap.keySet().iterator();
                  while (iter.hasNext())
                  {
                  DBKey key = (DBKey)iter.next();
//                    ConnectionPool pool = (ConnectionPool)
poolMap.remove(key);
                  pool.close();
                  }

                 poolMap.removeAll();
      }
    }

Eric Li





---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic