Error updating database. Cause: org.postgresql.util.PSQLException during background tasks

Hi

I cannot analysis one project. Maven Task (sonar:sonar) is ok but i have one error on background task. And i don’t see report on sonarqube

  • Sonarqube 5.6.2 on linux systems with PostgreSQL (Community Edition)
  • I show this error on background tasks
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   Execution time for each component visitor:
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - LoadComponentUuidsHavingOpenIssuesVisitor | time=1ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - IntegrateIssuesVisitor | time=14819ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - CloseIssuesOnRemovedComponentsVisitor | time=0ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - QualityModelMeasuresVisitor | time=72ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - NewQualityModelMeasuresVisitor | time=3ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - LastCommitVisitor | time=4ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ExecuteVisitorsStep]   - MeasureComputersVisitor | time=9ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Execute component visitors | time=14935ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute measure variations | time=1ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute Quality Gate measures | time=0ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute Quality profile measures | time=1ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Generate Quality profile events | time=1ms
2018.09.05 12:48:15 INFO  [o.s.s.c.s.ComputationStepExecutor] Generate Quality gate events | time=1ms
2018.09.05 12:48:16 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AWWpWIoFRQ7YKLpe5J0_
org.sonar.server.computation.component.VisitException: Visit failed for Component {key=com.imcfr.craquitaine.snea:SNEAPatchsPlugin,type=MODULE}  located com.imcfr.craquitaine.snea:SNEAPlugins(type=MODULE)->com.imcfr.craquitaine.snea:SNEA(type=MODULE)->com.imcfr.regionna.snea:snea-java(type=MODULE)->com.imcfr.regionna.snea:snea-racine(type=PROJECT)
	at org.sonar.server.computation.component.VisitException.rethrowOrWrap(VisitException.java:44) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:52) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.step.PersistComponentsStep.execute(PersistComponentsStep.java:77) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:75) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:81) [sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:56) [sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35) [sonar-server-5.6.2.jar:na]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_102]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_102]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_102]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_102]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_102]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_102]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_102]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERREUR: valeur trop longue pour le type character varying(2000)
### The error may involve org.sonar.db.component.ComponentMapper.insert-Inline
### The error occurred while setting parameters
### Cause: org.postgresql.util.PSQLException: ERREUR: valeur trop longue pour le type character varying(2000)
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar:3.2.7]
	at com.sun.proxy.$Proxy34.insert(Unknown Source) ~[na:na]
	at org.sonar.db.component.ComponentDao.insert(ComponentDao.java:278) ~[sonar-db-5.6.2.jar:na]
	at org.sonar.server.computation.step.PersistComponentsStep$PersistComponentStepsVisitor.persistComponent(PersistComponentsStep.java:171) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.step.PersistComponentsStep$PersistComponentStepsVisitor.persistAndPopulateCache(PersistComponentsStep.java:163) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.step.PersistComponentsStep$PersistComponentStepsVisitor.visitModule(PersistComponentsStep.java:129) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitNode(PathAwareCrawler.java:99) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:67) ~[sonar-server-5.6.2.jar:na]
	at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.6.2.jar:na]
	... 27 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERREUR: valeur trop longue pour le type character varying(2000)
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:412) ~[postgresql-9.3-1102-jdbc41.jar:na]
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.4.jar:1.4]
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.4.jar:1.4]
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:44) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:50) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71) ~[mybatis-3.2.7.jar:3.2.7]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152) ~[mybatis-3.2.7.jar:3.2.7]
	... 38 common frames omitted
2018.09.05 12:48:16 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=com.imcfr.regionna.snea:snea-racine | type=REPORT | id=AWWpWIoFRQ7YKLpe5J0_ | time=18252ms
  • I launch these commands : mvn sonar:sonar


[INFO] CPD calculation finished
[INFO] Analysis report generated in 2204ms, dir size=58 MB
[INFO] Analysis reports compressed in 4736ms, zip size=19 MB
[INFO] Analysis report uploaded in 2858ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://my-server/dashboard/index/com.imcfr.mon-projet:mon-projet-racine
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://my-server/api/ce/task?id=AWWplzYFRQ7YKLpe5J1A
[INFO] ------------------------------------------------------------------------

Hi,

From the error message, it appears that you have a project with deep module nesting which yields a location that works out to be longer than the 2000 characters we’ve allowed.

Since it doesn’t make sense to advocate reorganizing your project just to be able to analyze (altho at …4? levels deep, it might make sense to reorganize for other reasons…) your best bet is probably just to exclude the sub-sub-sub module from analysis.

HTH,
Ann

Hi,

Thanks for reply.

I have tried to exclude sub-sub module with sonar.exclusions property

  <plugins>
  	<plugin>
  		<groupId>org.sonarsource.scanner.maven</groupId>
  		<artifactId>sonar-maven-plugin</artifactId>
  		<version>5.7.0.15470</version>
  		<configuration>
  			<sonar.language>java</sonar.language>
  			<sonar.exclusions>**/snea-solr*,**/snea-sql*,**/snea-ms1*</sonar.exclusions>
  		</configuration>
  	</plugin>
  </plugins>

But, during analysing, sub-modules of snea-ms1 are analysed by SONAR. I have probably one error of configuration

Lilian.

Hi,

Exclusions are not easy to set properly via configuration. That’s why I always advise that you use the UI for this.

As for the actual path to provide to the exclusions, well that’s a little more difficult. Normally I’d tell you to look at the path the UI shows you for the files and use a regexed version of that, but… :slightly_frowning_face:

Ann

Hi Lilian,

For information this bug is fixed in version 7.2: https://jira.sonarsource.com/browse/SONAR-10567

Regards

1 Like

Hi Simon and Ann,

OK, it’s noted
Thanks for reply.

Regards,
Lilian.