8

我有一个 grails 应用程序在以 H2 作为数据库的 cloudfoundry 中成功运行。我现在想切换到 postgresql。当我在本地针对 postgreSQL 运行应用程序时,一切都按预期工作。

在 cloudfoundry 实例上,我在一个相当长的运行分析期间遇到异常,我将其作为后台任务执行(使用 grails 执行器插件)。在这个异步任务中

def future = executorService.submit({
    return analysisService.analyzeProject(model, project)
})

我从数据库中得到以下异常:

2012-11-26 10:27:38,319 [pool-2-thread-1] ERROR interceptor.TransactionInterceptor  - Application exception overridden by rollback exception
org.springframework.dao.DataAccessResourceFailureException: Hibernate operation: could not execute query; SQL [select this_.id as id8_0_, this_.version as version8_0_, this_.language as language8_0_, this_.url as url8_0_ from sonar_adapter_configuration this_]; FATAL: terminating connection due to administrator command; nested exception is org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command
    at myapp.adapters.sonar.SonarAdapterService.loadSonarConfig(SonarAdapterService.groovy:184)
    at myapp.adapters.sonar.SonarAdapterService.determineArtefactSizes(SonarAdapterService.groovy:145)
    at myapp.project.AnalysisService.analyzeProject(AnalysisService.groovy:46)
    at myapp.project.ProjectController$_analyzeProject_closure2.doCall(ProjectController.groovy:69)
    at grails.plugin.executor.PersistenceContextRunnableWrapper$_run_closure1.doCall(PersistenceContextRunnableWrapper.groovy:34)
    at grails.plugin.executor.PersistenceContextWrapper.wrap(PersistenceContextWrapper.groovy:35)
    at grails.plugin.executor.PersistenceContextRunnableWrapper.run(PersistenceContextRunnableWrapper.groovy:34)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
    ... 13 more

有什么想法可能导致这种情况吗?

4

1 回答 1

4

您可能会为长时间运行的连接设置超时(如果我没记错的话,这是无法更改的,因为它是为了保护服务器免受会消耗所有 cpu/io 的格式错误的查询)

您可能想要尝试的是将长时间运行的查询分割成较小的查询并总结结果(如果它是一个选择)

于 2012-11-26T13:46:49.133 回答