glassfish
  1. glassfish
  2. GLASSFISH-19416

the value of monitor becomes negative value

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: monitoring
    • Labels:
      None

      Description

      I execute under two commands:
      1.set resources.jdbc-connection-pool.oracle_pool.pooling=false
      2.enable-monitoring --modules jdbc-connection-pool=HIGH

      then I get three jdbc connections from oracle_pool by my application.
      at this time I find the value of "numconnfree-current" which become negative value

        Activity

        Hide
        boernd added a comment - - edited

        Hi,

        we also got this phenomenon of negative values (gf 3.1.2.2) with the numConnUsed count. I changed the decrementConnectionUsedEvent method the same way:

                    //Decrement numConnUsed counter
                    synchronized(numConnUsed) {
                        long numConnUsedToSet = (numConnUsed.getCurrent() - 1 >= 0) ? numConnUsed.getCurrent() - 1 : 0;                
                        numConnUsed.setCurrent(numConnUsedToSet);
                    }
        
        Show
        boernd added a comment - - edited Hi, we also got this phenomenon of negative values (gf 3.1.2.2) with the numConnUsed count. I changed the decrementConnectionUsedEvent method the same way: //Decrement numConnUsed counter synchronized (numConnUsed) { long numConnUsedToSet = (numConnUsed.getCurrent() - 1 >= 0) ? numConnUsed.getCurrent() - 1 : 0; numConnUsed.setCurrent(numConnUsedToSet); }
        Hide
        jifeng added a comment -

        Hi:

        Byron Nevins

        I find This phenomenon also occurs in glassfish v4 .

        I added one line of code which is marked as "★" , and it works fine.

        com.sun.enterprise.resource.pool.monitor.JdbcConnPoolStatsProvider.java
        @ProbeListener(JDBC_PROBE_LISTENER + "decrementNumConnFreeEvent")
            public void decrementNumConnFreeEvent(
                @ProbeParam("poolName") String poolName,
                @ProbeParam("appName") String appName,
                @ProbeParam("moduleName") String moduleName
             ) {
             ......
                synchronized(numConnFree) {
                    long numConnFreeToSet = (numConnFree.getCurrent() - 1 >= 0) ? numConnFree.getCurrent() - 1 : 0;★
                    numConnFree.setCurrent(numConnFreeToSet);
                }
             }
            }

        could you please confirm it and give me some suggestions?

        Show
        jifeng added a comment - Hi: Byron Nevins I find This phenomenon also occurs in glassfish v4 . I added one line of code which is marked as "★" , and it works fine. com.sun.enterprise.resource.pool.monitor.JdbcConnPoolStatsProvider.java @ProbeListener(JDBC_PROBE_LISTENER + "decrementNumConnFreeEvent" ) public void decrementNumConnFreeEvent( @ProbeParam( "poolName" ) String poolName, @ProbeParam( "appName" ) String appName, @ProbeParam( "moduleName" ) String moduleName ) { ...... synchronized (numConnFree) { long numConnFreeToSet = (numConnFree.getCurrent() - 1 >= 0) ? numConnFree.getCurrent() - 1 : 0;★ numConnFree.setCurrent(numConnFreeToSet); } } } could you please confirm it and give me some suggestions?
        Hide
        jifeng added a comment -

        I modify this method : JdbcConnPoolSatasProvider#decrementNumConnFreeEvent

        Show
        jifeng added a comment - I modify this method : JdbcConnPoolSatasProvider#decrementNumConnFreeEvent
        Hide
        jifeng added a comment -

        I create a patch and it works fine, cloud you please confirm it.

        Show
        jifeng added a comment - I create a patch and it works fine, cloud you please confirm it.
        Hide
        jifeng added a comment -

        I think the code which is marked as "★" has problem
        because there is no connection in the pool when the state of pool is unpooling

        ConnectionPool.java
        
        public String internalGetResource()
        {   
            ........
            if (result != null) {
             if (maxConnectionUsage_ > 0) {
                   result.incrementUsageCount();
             }
             if (poolLifeCycleListener != null) {
                   poolLifeCycleListener.connectionUsed(result.getId());
                  //Decrement numConnFree
                  poolLifeCycleListener.decrementNumConnFree(); "★" 
             }
            }
        }
        
        Show
        jifeng added a comment - I think the code which is marked as "★" has problem because there is no connection in the pool when the state of pool is unpooling ConnectionPool.java public String internalGetResource() { ........ if (result != null ) { if (maxConnectionUsage_ > 0) { result.incrementUsageCount(); } if (poolLifeCycleListener != null ) { poolLifeCycleListener.connectionUsed(result.getId()); //Decrement numConnFree poolLifeCycleListener.decrementNumConnFree(); "★" } } }

          People

          • Assignee:
            Byron Nevins
            Reporter:
            jifeng
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: