Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-5081

Used Druid JDBC Connection Pool,Sometimes Throws Exception Connection is null or closed.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.14.0
    • 4.14.0
    • None
    • Spring:4.3

      Mybais:3.2.2

      mybais-spring:1.2.0

      Hbase:1.2.6

      Hadoop:2.7.5

    • Important

    Description

      Driuid Spring Config:

      <!-- Phoneix DataSource -->
      <bean name="dataSource1" class="com.alibaba.druid.pool.DruidDataSource"
      init-method="init" destroy-method="close">
      <property name="driverClassName" value="org.apache.phoenix.jdbc.PhoenixDriver" />
      <property name="url" value="${jdbc_hbase_url}" />
      <property name="username" value="${jdbc_hbase_username}" />
      <property name="password" value="${jdbc_hbase_password}" />
      <property name="connectionProperties"
      value="phoenix.connection.schema=${jdbc_hbase_schema};
      phoenix.schema.isNamespaceMappingEnabled=true;
      phoenix.schema.mapSystemTablesToNamespace=true;
      phoenix.query.timeoutMs=1800000;
      phoenix.query.threadPoolSize=512MB;
      hbase.regionserver.lease.period=1800000;
      hbase.rpc.timeout=1800000;
      hbase.client.scanner.caching=1000;
      hbase.client.scanner.timeout.period=1800000;"/>
      <property name="initialSize" value="0" />
      <property name="maxActive" value="20" />
      <property name="minIdle" value="0" />
      <property name="maxWait" value="60000" />
      <property name="poolPreparedStatements" value="true" />
      <property name="maxPoolPreparedStatementPerConnectionSize"
      value="33" />
      <!-- <property name="validationQuery" value="${validationQuery}" /> -->
      <property name="testOnBorrow" value="false" />
      <property name="testOnReturn" value="false" />
      <property name="testWhileIdle" value="true" />
      <property name="timeBetweenEvictionRunsMillis" value="60000" />
      <property name="minEvictableIdleTimeMillis" value="25200000" />
      <property name="removeAbandoned" value="true" />
      <property name="removeAbandonedTimeout" value="1800" />
      <property name="logAbandoned" value="true" />
      <property name="filters" value="mergeStat" />
      <property name="defaultAutoCommit" value="true" />
      </bean>

      Exception:

          1. Error updating database. Cause: java.sql.SQLException: java.lang.IllegalArgumentException: Connection is null or closed.
          2. The error may involve defaultParameterMap
          3. The error occurred while setting parameters
          4. SQL: UPSERT INTO TD_RECODE( SN, INTIME, RECODE, IP ) VALUES( ?, ?, ?, ? )
          5. Cause: java.sql.SQLException: java.lang.IllegalArgumentException: Connection is null or closed.
            ; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; java.lang.IllegalArgumentException: Connection is null or closed.; nested exception is java.sql.SQLException: java.lang.IllegalArgumentException: Connection is null or closed.
            at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
            at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
            at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
            at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
            at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
            at com.sun.proxy.$Proxy23.update(Unknown Source)
            at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:250)
            at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:49)
            at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
            at com.sun.proxy.$Proxy35.saveRecord(Unknown Source)
            at com.chis.jmll.sjcj.dao.SaveRecodeTx.run(SaveRecodeTx.java:34)
            at com.chis.jmll.comm.TxMgmtModule.executeHUpdate(TxMgmtModule.java:98)
            at com.chis.jmll.sjcj.service.impl.SjcjServiceImpl.saveRecode(SjcjServiceImpl.java:47)
            at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java)
            at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:45)
            at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:71)
            at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:48)
            at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
            at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:61)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:41)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.ExecuteLimitFilter.invoke(ExecuteLimitFilter.java:59)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:77)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:131)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:37)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:37)
            at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
            at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:95)
            at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
            at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:168)
            at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:50)
            at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:79)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
            at java.lang.Thread.run(Thread.java:745)
            Caused by: java.sql.SQLException: java.lang.IllegalArgumentException: Connection is null or closed.
            at org.apache.phoenix.query.ConnectionQueryServicesImpl.metaDataCoprocessorExec(ConnectionQueryServicesImpl.java:1325)
            at org.apache.phoenix.query.ConnectionQueryServicesImpl.metaDataCoprocessorExec(ConnectionQueryServicesImpl.java:1287)
            at org.apache.phoenix.query.ConnectionQueryServicesImpl.getTable(ConnectionQueryServicesImpl.java:1504)
            at org.apache.phoenix.query.DelegateConnectionQueryServices.getTable(DelegateConnectionQueryServices.java:108)
            at org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:596)
            at org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:519)
            at org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:511)
            at org.apache.phoenix.schema.MetaDataClient.updateCache(MetaDataClient.java:507)
            at org.apache.phoenix.execute.MutationState.validate(MutationState.java:805)
            at org.apache.phoenix.execute.MutationState.validateAll(MutationState.java:793)
            at org.apache.phoenix.execute.MutationState.send(MutationState.java:1005)
            at org.apache.phoenix.execute.MutationState.send(MutationState.java:1496)
            at org.apache.phoenix.execute.MutationState.commit(MutationState.java:1328)
            at org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:562)
            at org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:559)
            at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
            at org.apache.phoenix.jdbc.PhoenixConnection.commit(PhoenixConnection.java:559)
            at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:396)
            at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:376)
            at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
            at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:374)
            at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:363)
            at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:269)
            at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:172)
            at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:177)
            at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
            at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
            at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
            at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
            at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
            at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:55)
            at com.sun.proxy.$Proxy43.execute(Unknown Source)
            at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
            at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
            at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
            at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
            at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
            at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
            at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
            ... 39 more
            Caused by: java.lang.IllegalArgumentException: Connection is null or closed.
            at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:308)
            at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getTable(ConnectionManager.java:747)
            at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getTable(ConnectionManager.java:729)
            at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getTable(ConnectionManager.java:724)
            at org.apache.phoenix.query.HTableFactory$HTableFactoryImpl.getTable(HTableFactory.java:51)
            at org.apache.phoenix.query.ConnectionQueryServicesImpl.getTable(ConnectionQueryServicesImpl.java:456)
            at org.apache.phoenix.query.ConnectionQueryServicesImpl.metaDataCoprocessorExec(ConnectionQueryServicesImpl.java:1304)
            ... 83 more

      Attachments

        Activity

          People

            Unassigned Unassigned
            huangzh huangzh
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified