title: Sonarqube hangs when storing results in database with java.sql.SQLException
body: <p>I was trying to install sonar instance on EC2 Ubuntu server and migrate the old mysql database to the server. It had worked fine until I updated Sonargraph, Java and Git plugins and wanted to rebuild sonar using Gradle. The build hangs for 30-50min when trying to store results in mysql database and then fails with java.sql.SQLException: Already closed.</p>
  
  <p>Here's the part of the error log that I receive when running gradlew:</p>
  
  <pre><code>15:22:49.747 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :sonarqube FAILED
  15:22:49.748 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :sonarqube (Thread[Daemon Thread 3,5,main]) completed. Took 45 mins 23.097 secs.
  15:22:49.748 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon Thread 3,5,main]] finished, busy: 45 mins 58.672 secs, idle: 0.058 secs
  15:22:49.752 [ERROR] [org.gradle.BuildExceptionReporter]
  15:22:49.752 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
  15:22:49.753 [ERROR] [org.gradle.BuildExceptionReporter]
  15:22:49.753 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
  15:22:49.753 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':sonarqube'.
  15:22:49.753 [ERROR] [org.gradle.BuildExceptionReporter] &gt; Unable to execute Sonar
  15:22:49.754 [ERROR] [org.gradle.BuildExceptionReporter]
  15:22:49.754 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
  15:22:49.755 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
  15:22:49.755 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
  15:22:49.755 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
  15:22:49.756 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
  15:22:49.756 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
  15:22:49.756 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
  15:22:49.756 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
  15:22:49.756 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
  15:22:49.757 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
  15:22:49.757 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
  15:22:49.757 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
  15:22:49.757 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
  15:22:49.757 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
  15:22:49.758 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
  15:22:49.758 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
  15:22:49.758 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
  15:22:49.758 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
  15:22:49.758 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
  15:22:49.759 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
  15:22:49.759 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
  15:22:49.759 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
  15:22:49.759 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
  15:22:49.759 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
  15:22:49.760 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
  15:22:49.760 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
  15:22:49.760 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
  15:22:49.760 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
  15:22:49.761 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
  15:22:49.761 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
  15:22:49.761 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
  15:22:49.761 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
  15:22:49.761 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  15:22:49.762 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.762 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
  15:22:49.762 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.762 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
  15:22:49.762 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.763 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
  15:22:49.763 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.763 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
  15:22:49.763 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.764 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
  15:22:49.764 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
  15:22:49.764 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.util.Swapper.swap(Swapper.java:38)
  15:22:49.764 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
  15:22:49.764 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.765 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
  15:22:49.765 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  15:22:49.765 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.765 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
  15:22:49.765 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  15:22:49.766 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.767 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
  15:22:49.767 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.767 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
  15:22:49.767 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.767 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
  15:22:49.768 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  15:22:49.768 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
  15:22:49.768 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
  15:22:49.768 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
  15:22:49.769 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
  15:22:49.769 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
  15:22:49.769 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.sonar.runner.impl.RunnerException: Unable to execute Sonar
  15:22:49.769 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
  15:22:49.770 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
  15:22:49.770 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
  15:22:49.770 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
  15:22:49.770 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
  15:22:49.770 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.api.Runner.execute(Runner.java:100)
  15:22:49.771 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:50)
  15:22:49.771 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
  15:22:49.771 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
  15:22:49.771 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
  15:22:49.772 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
  15:22:49.772 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
  15:22:49.772 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
  15:22:49.772 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
  15:22:49.772 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
  15:22:49.773 [ERROR] [org.gradle.BuildExceptionReporter]    ... 66 more
  15:22:49.773 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.hibernate.exception.GenericJDBCException: Cannot release connection
  15:22:49.773 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
  15:22:49.774 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
  15:22:49.774 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
  15:22:49.774 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
  15:22:49.774 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
  15:22:49.774 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:429)
  15:22:49.775 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.jdbc.ConnectionManager.afterTransaction(ConnectionManager.java:316)
  15:22:49.775 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:248)
  15:22:49.775 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:158)
  15:22:49.775 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
  15:22:49.776 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.jpa.session.JpaDatabaseSession.commit(JpaDatabaseSession.java:83)
  15:22:49.776 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.jpa.session.JpaDatabaseSession.commitAndClose(JpaDatabaseSession.java:69)
  15:22:49.776 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.jpa.session.JpaDatabaseSession.stop(JpaDatabaseSession.java:64)
  15:22:49.777 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
  15:22:49.777 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.stop(ReflectionLifecycleStrategy.java:96)
  15:22:49.777 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.stop(AbstractInjectionFactory.java:88)
  15:22:49.778 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.behaviors.AbstractBehavior.stop(AbstractBehavior.java:179)
  15:22:49.778 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.behaviors.Stored$RealComponentLifecycle.stop(Stored.java:141)
  15:22:49.778 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.behaviors.Stored.stop(Stored.java:118)
  15:22:49.779 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1047)
  15:22:49.779 [ERROR] [org.gradle.BuildExceptionReporter]    at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:802)
  15:22:49.779 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:123)
  15:22:49.780 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.api.platform.ComponentContainer.stopComponents(ComponentContainer.java:118)
  15:22:49.780 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.batch.bootstrapper.Batch.stop(Batch.java:107)
  15:22:49.780 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
  15:22:49.780 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
  15:22:49.781 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
  15:22:49.781 [ERROR] [org.gradle.BuildExceptionReporter]    ... 80 more
  15:22:49.781 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.sql.SQLException: Already closed.
  15:22:49.781 [ERROR] [org.gradle.BuildExceptionReporter]    at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)
  15:22:49.782 [ERROR] [org.gradle.BuildExceptionReporter]    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)
  15:22:49.782 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:97)
  15:22:49.782 [ERROR] [org.gradle.BuildExceptionReporter]    at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:474)
  15:22:49.782 [ERROR] [org.gradle.BuildExceptionReporter]    ... 102 more
  15:22:49.783 [ERROR] [org.gradle.BuildExceptionReporter]
  15:22:49.783 [LIFECYCLE] [org.gradle.BuildResultLogger]
  15:22:49.783 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
  15:22:49.784 [LIFECYCLE] [org.gradle.BuildResultLogger]
  15:22:49.784 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 46 mins 1.31 secs
  </code></pre>
  
  <p>When I go over the same procedure with sonar running on my local computer (same config file settings, etc), gradle build doesn't hang and finishes successfully.</p>
  
  <p>I'm using following versions:</p>
  
  <ul>
  <li>sonar 5.1.1 (application)</li>
  <li>sonarqube 1.0 (gradle plugin)</li>
  <li>gradle 1.11</li>
  <li>java 8 (project to analyse)</li>
  <li>mysql 5.5.43 (database sonar connects to)</li>
  <li>java plugin 3.3 (sonar plugin)</li>
  <li>sonargraph 3.4.2 (sonar plugin)</li>
  <li>git 1.1 (sonar plugin)</li>
  </ul>
  
  <p>Why does the database step hang for so long and fail?</p>