Versions
- SonarQube: 7.5-community
- SonarQube Community Plugin: 2.6.4
All requirements described here are met: https://docs.sonarqube.org/7.5/requirements/requirements/
What are you trying to achieve
I’m trying to inspect code locally, but it always fails in the same page when downloading the issues from the server
What have you tried so far to achieve this
From the web.log I got
2019.02.07 00:55:57 ERROR web[AWjFc+1UY34LGbgvAAAU][o.s.s.w.WebServiceEngine] Fail to process request http://sonarqubehost/api/issues/search?componentRoots=company:project&p=21&ps=-1&resolved=false
java.lang.IllegalStateException: Fail to execute ES search request 'SearchRequest{searchType=QUERY_THEN_FETCH, indices=[issues], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_alisases_to_multiple_indices=true, forbid_closed_indices=true], types=[issue], routing='AWjAFmEIDkrPwkY34RMs', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=128, source={
"from" : 10000,
"size" : 500,
"query" : {
"bool" : {
"must" : [
{
"match_all" : {
"boost" : 1.0
}
}
],
"filter" : [
{
"bool" : {
"must" : [
{
"term" : {
"isMainBranch" : {
"value" : "true",
"boost" : 1.0
}
}
},
{
"bool" : {
"must_not" : [
{
"exists" : {
"field" : "resolution",
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
{
"terms" : {
"project" : [
"AWjAFmEIDkrPwkY34RMs"
],
"boost" : 1.0
}
},
{
"terms" : {
"type" : [
"BUG",
"VULNERABILITY",
"CODE_SMELL"
],
"boost" : 1.0
}
},
{
"bool" : {
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
{
"has_parent" : {
"query" : {
"bool" : {
"filter" : [
{
"bool" : {
"should" : [
{
"term" : {
"allowAnyone" : {
"value" : true,
"boost" : 1.0
}
}
},
{
"term" : {
"userIds" : {
"value" : 1,
"boost" : 1.0
}
}
},
{
"term" : {
"groupIds" : {
"value" : 1,
"boost" : 1.0
}
}
},
{
"term" : {
"groupIds" : {
"value" : 2,
"boost" : 1.0
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"parent_type" : "authorization",
"score" : false,
"ignore_unmapped" : false,
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"_source" : false,
"sort" : [
{
"issueCreatedAt" : {
"order" : "desc",
"missing" : "_first"
}
},
{
"project" : {
"order" : "asc",
"missing" : "_first"
}
},
{
"filePath" : {
"order" : "asc",
"missing" : "_first"
}
},
{
"line" : {
"order" : "asc",
"missing" : "_first"
}
},
{
"key" : {
"order" : "asc",
"missing" : "_first"
}
}
],
"aggregations" : {
"effort" : {
"sum" : {
"field" : "effort"
}
}
}
}}' on indices '[issues]' on types '[issue]'
at org.sonar.server.es.request.ProxySearchRequestBuilder.get(ProxySearchRequestBuilder.java:44)
at org.sonar.server.es.request.ProxySearchRequestBuilder.get(ProxySearchRequestBuilder.java:32)
at org.sonar.server.issue.index.IssueIndex.search(IssueIndex.java:300)
at org.sonar.server.issue.ws.SearchAction.doHandle(SearchAction.java:402)
at org.sonar.server.issue.ws.SearchAction.handle(SearchAction.java:383)
at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:110)
at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:88)
at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126)
at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:87)
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.CacheControlFilter.doFilter(CacheControlFilter.java:76)
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:76)
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:199)
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:81)
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:803)
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:1459)
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.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:272)
at org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:130)
at org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseDone(AbstractSearchAsyncAction.java:241)
at org.elasticsearch.action.search.InitialSearchPhase.onShardFailure(InitialSearchPhase.java:90)
at org.elasticsearch.action.search.InitialSearchPhase.access$100(InitialSearchPhase.java:46)
at org.elasticsearch.action.search.InitialSearchPhase$1.onFailure(InitialSearchPhase.java:169)
at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1067)
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1171)
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1149)
at org.elasticsearch.transport.TransportService$7.onFailure(TransportService.java:655)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:623)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
... 1 common frames omitted
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [10500]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.
at org.elasticsearch.search.DefaultSearchContext.preProcess(DefaultSearchContext.java:203)
at org.elasticsearch.search.query.QueryPhase.preProcess(QueryPhase.java:95)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:497)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:461)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:257)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:343)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:340)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
... 3 common frames omitted
Via browser I get the following when I access http://sonarqubehost/api/issues/search?componentRoots=company:project&p=21&ps=-1&resolved=false
{"errors":[{"msg":"An error has occurred. Please contact your administrator"}]}
but if I remove ps=-1 from the url to http://sonarqubehost/api/issues/search?componentRoots=company:project&p=21&resolved=false, then I can retrieve the json
Digging the message Result window is too large, from + size must be less than or equal to: [10000] but was [10500]
I’ve found that is kinda of usual problem (https://stackoverflow.com/questions/35206409/elasticsearch-2-1-result-window-is-too-large-index-max-result-window/35223055#35223055) and the solution seems simple by increasing the value of index.max_result_window.
To do that, I need to access the ES endpoint and put the modification. I configure the http port for ES using the property sonar.search.httpPort: “9002”, this is the sonar.log:
2019.02.07 00:53:35 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.02.07 00:53:35 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.02.07 00:53:35 WARN app[][o.s.a.es.EsSettings] Elasticsearch HTTP connector is enabled on port 9002. MUST NOT BE USED FOR PRODUCTION
2019.02.07 00:53:36 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2019.02.07 00:53:36 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.02.07 00:53:36 INFO app[][o.e.p.PluginsService] no modules loaded
2019.02.07 00:53:36 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.02.07 00:53:47 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.02.07 00:53:47 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process2586701126237365471properties
2019.02.07 00:53:59 INFO app[][o.s.a.SchedulerImpl] Process[web] is up
2019.02.07 00:53:59 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process3410187530769451499properties
2019.02.07 00:54:04 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up
2019.02.07 00:54:04 INFO app[][o.s.a.SchedulerImpl] SonarQube is up
2019.02.07 01:24:06 INFO app[][o.s.a.SchedulerImpl] Stopping SonarQube
2019.02.07 01:24:09 INFO app[][o.s.a.SchedulerImpl] Process [ce] is stopped
2019.02.07 01:24:11 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped
2019.02.07 01:24:11 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2019.02.07 01:24:11 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
2019.02.07 01:24:11 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2019.02.07 01:24:12 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.02.07 01:24:12 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.02.07 01:24:12 WARN app[][o.s.a.es.EsSettings] Elasticsearch HTTP connector is enabled on port 9002. MUST NOT BE USED FOR PRODUCTION
2019.02.07 01:24:13 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es
2019.02.07 01:24:13 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.02.07 01:24:13 INFO app[][o.e.p.PluginsService] no modules loaded
2019.02.07 01:24:13 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.02.07 01:24:23 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2019.02.07 01:24:23 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3673563182785077677properties
2019.02.07 01:24:36 INFO app[][o.s.a.SchedulerImpl] Process[web] is up
2019.02.07 01:24:36 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.2.5.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process2982998961678868789properties
2019.02.07 01:24:41 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up
2019.02.07 01:24:41 INFO app[][o.s.a.SchedulerImpl] SonarQube is up
but I’m not sure if it’s working, the port is not accessible
curl -XPUT "http://127.0.0.1:9002/issues/_settings" -d '{ "index" : { "max_result_window" : 500000 } }'
curl: (7) Failed to connect to 127.0.0.1 port 9002: Connection refused
telnet 127.0.0.1 9002
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Tried to update directly the elasticsearch.yml file as well, but it’s generated during the startup and the config is lost during restart.
Does someone ran into this problem before? Any hints?
Thanks!