Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-9814

System passcode can't be used when db connectivity is down

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6-M3, 6.6
    • Component/s: Web API
    • Labels:

      Description

      When DB is down, the WS api/system/health returns a 500 error when the system passcode is sent in request.

      2017.09.13 09:49:40 ERROR web[][o.s.s.p.w.RootFilter] Processing of request /api/system/health failed
      org.apache.ibatis.exceptions.PersistenceException: 
      ### Error querying database.  Cause: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
      ### The error may exist in org.sonar.db.property.PropertiesMapper
      ### The error may involve org.sonar.db.property.PropertiesMapper.selectByKey
      ### The error occurred while executing a query
      ### Cause: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
              at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
              at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
              at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
              at com.sun.proxy.$Proxy16.selectByKey(Unknown Source)
              at org.sonar.db.property.PropertiesDao.selectGlobalProperty(PropertiesDao.java:115)
              at org.sonar.db.property.PropertiesDao.selectGlobalProperty(PropertiesDao.java:121)
              at org.sonar.server.setting.DatabaseSettingLoader.load(DatabaseSettingLoader.java:39)
              at org.sonar.server.setting.ThreadLocalSettings.get(ThreadLocalSettings.java:109)
              at org.sonar.api.config.Settings.getRawString(Settings.java:90)
              at org.sonar.api.config.Settings.getString(Settings.java:140)
              at org.sonar.api.config.internal.ConfigurationBridge.get(ConfigurationBridge.java:39)
              at org.sonar.api.config.Configuration.getBoolean(Configuration.java:128)
              at org.sonar.server.authentication.UserSessionInitializer.failIfAuthenticationIsRequired(UserSessionInitializer.java:132)
              at org.sonar.server.authentication.UserSessionInitializer.loadUserSession(UserSessionInitializer.java:124)
              at org.sonar.server.authentication.UserSessionInitializer.initUserSession(UserSessionInitializer.java:94)
              at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:86)
              at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:71)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:72)
              at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:48)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:61)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
              at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
              at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
              at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
              at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
              at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
              at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:748)
      Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
              at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:265)
              at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
              at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
              at org.postgresql.Driver.makeConnection(Driver.java:450)
              at org.postgresql.Driver.connect(Driver.java:252)
              at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
              at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
              at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
              at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
              at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
              at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
              at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323)
              at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:138)
              at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:60)
              at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336)
              at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:88)
              at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:59)
              at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
              at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
              at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
              at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
              ... 52 common frames omitted
      Caused by: java.net.ConnectException: Connection refused (Connection refused)
              at java.net.PlainSocketImpl.socketConnect(Native Method)
              at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
              at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
              at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
              at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
              at java.net.Socket.connect(Socket.java:589)
              at org.postgresql.core.PGStream.<init>(PGStream.java:68)
              at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144)
              ... 73 common frames omitted
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              simon.brandhof Simon Brandhof (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: