hibernate.c3p0.validate is ignored in crowd.cfg.xml

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 4.2.2, 4.4.0
    • Component/s: Database
    • None
    • 2
    • Severity 3 - Minor

      hibernate.c3p0.validate is ignored in crowd.cfg.xml

      Issue Summary

      Even hibernate.c3p0.validate parameter is set to true in crowd.cfg.xml, we can see that c3p0 is initated with testConnectionOnCheckout is set to false. Based on the
      c3p0 - Appendix C: Hibernate-specific notes documentation, the hibernate.c3p0.validate setting is mapped to the c3p0.testConnectionOnCheckout and setting the hibernate one, overrides the configuration for the c3p0.

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Create a new Crowd environment
      2. Set the hibernate.c3p0.validate to true on crowd.cfg.xml:
        <property name="hibernate.c3p0.validate">true</property>
        
      3. Restart Crowd and check the startup logs containing the Initializing c3p0 pool string.

      Expected Results

      2022-XX-YY XX:YY:ZZ,MMM localhost-startStop-1 INFO [v2.c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@XYZ [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@XYZ
      [ acquireIncrement -> 1
      [...]
      idleConnectionTestPeriod -> 100
      initialPoolSize -> 0
      maxAdministrativeTaskTime -> 0
      maxConnectionAge -> 0
      maxIdleTime -> 30
      maxIdleTimeExcessConnections -> 0
      maxPoolSize -> 30
      maxStatements -> 0
      maxStatementsPerConnection -> 0
      minPoolSize -> 0
      [...]
      jdbcUrl -> jdbc:postgresql://localhost:5432/xyz
      properties -> {password=******
      user=******} ]
      preferredTestQuery -> null
      [...]
      testConnectionOnCheckin -> false
      testConnectionOnCheckout -> true
      [...]
      ]
      

      Actual Results

      2022-XX-YY XX:YY:ZZ,MMM localhost-startStop-1 INFO [v2.c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@XYZ [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@XYZ 
      [ acquireIncrement -> 1
      [...]
      idleConnectionTestPeriod -> 100
      initialPoolSize -> 0
      maxAdministrativeTaskTime -> 0
      maxConnectionAge -> 0
      maxIdleTime -> 30
      maxIdleTimeExcessConnections -> 0
      maxPoolSize -> 30
      maxStatements -> 0
      maxStatementsPerConnection -> 0
      minPoolSize -> 0
      [...]
      jdbcUrl -> jdbc:postgresql://localhost:5432/xyz
      properties -> {password=******
      user=******} ]
      preferredTestQuery -> null
      [...]
      testConnectionOnCheckin -> false
      testConnectionOnCheckout -> false
      [...]
      ]
      

      Workaround

      You can set hibernate.c3p0.testConnectionOnCheckout to true for using Connection testing in Crowd. After setting this, you can confirm the testConnectionOnCheckout parameter will be changed to true while c3p0 pool initializing.

      <property name="hibernate.c3p0.testConnectionOnCheckout">true</property>
      

            Assignee:
            Unassigned
            Reporter:
            Basar Beykoz (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: