sonar V.4.3.1 不以 postgresql 开头

Posted

技术标签:

【中文标题】sonar V.4.3.1 不以 postgresql 开头【英文标题】:sonar V.4.3.1 does not start with postgresql 【发布时间】:2014-06-20 21:00:15 【问题描述】:

步骤 - 安装服务器 - 更改 JDBC URL 以指向新创建的 poststreSQL 数据库(默认模式 / 带有声纳用户)。那里默认的 H2 JDBC URL 被禁用,并且只激活了 postgreSQL JDBC URL - DB用户名和密码仍然是默认的(声纳/声纳) - 启动服务器时,我看到表创建成功,但是服务器没有成功启动。以下显示在日志中。

---------------部分日志开始-----------

2014.06.19 16:18:00 ERROR [jruby.rack]  initialization failed
org.jruby.rack.RackInitializationException: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: stack depth limit exceeded
  Hint: Increase the configuration parameter "max_stack_depth" (currently 2048kB), after ensuring the platform's stack depth limit is adequate.
### The error may exist in org.sonar.core.rule.RuleMapper
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT       rrt.id, rrt.rule_id as "ruleId", rrt.rule_tag_id as "tagId", rrt.tag_type as "type", rt.tag         FROM rules_rule_tags rrt     JOIN rule_tags rt ON rrt.rule_tag_id = rt.id      WHERE  ((rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=? or rrt.rule_id=?

---------- 结束 ----------

sql select 语句一直执行,直到出现以下内容:

--------- 开始 ------------

### Cause: org.postgresql.util.PSQLException: ERROR: stack depth limit exceeded
  Hint: Increase the configuration parameter "max_stack_depth" (currently 2048kB), after ensuring the platform's stack depth limit is adequate.
    at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:31) ~[jruby-rack-1.1.13.2.jar:na]
    at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98) ~[jruby-rack-1.1.13.2.jar:na]
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50) ~[jruby-rack-1.1.13.2.jar:na]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) [tomcat-embed-core-7.0.42.jar:7.0.42]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) [tomcat-embed-core-7.0.42.jar:7.0.42]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.42.jar:7.0.42]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [tomcat-embed-core-7.0.42.jar:7.0.42]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [tomcat-embed-core-7.0.42.jar:7.0.42]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]

【问题讨论】:

很奇怪。这通常只发生在递归函数调用或递归触发器中。这似乎也不是。能否在postgresql.conf中启用log_statement = alllog_min_messages =debug1,重启PostgreSQL,重新测试并发布结果日志? 这里有同样的问题。尝试通过电子邮件发送 sonarqube 的用户列表,没有回复。 @HaythamMohamed - 我刚刚注意到 SQL 语句有 117 次重复“OR rrt.rule_id = ?”。当你说它“继续进行”时,你的意思是有更多的重复吗? 【参考方案1】:

我猜这是 PostgreSQL 中的解析错误,而不是执行错误。由于这是 SQL,因此使用基于堆栈的解析器是正常的。这自然会使用像

这样的解析器生成
conditions ::== boolean_term
conditions ::== boolean_term boolean_op conditions 

其中每个额外的 boolean_term 都可能导致堆栈推送/递归。有一百多个'a =?'术语,甚至更多,解析堆栈可能会变得非常大。

@HaythamMohamed,任何可能有 2000 次或更多的重复

OR rrt.rule_id = ?

在这个查询中?

如果是这样,您需要更改 Sonar、JRuby.rack 或 apache abatis 使用的 SQL 生成。

【讨论】:

以上是关于sonar V.4.3.1 不以 postgresql 开头的主要内容,如果未能解决你的问题,请参考以下文章

安全测试-代码质量扫描 SonarQube

sonarqube代码核查+jenkins构建判断

sonarqube代码核查+jenkins构建判断

sonarqube代码核查+jenkins构建判断

sonar7的介绍

sonar8.5.0升级为sonar8.5.3之后为啥很卡?