Build on AzDO pipeline to SonarQ on AzDO machine

hi
I’m using SonarQ 9.0.
I have a solution (200K LOC) in the pipeline on “dev.azure.com”. we are switching Sonar server from on-premise to AzDO server.
build of this solution without Sonar takes 60 seconds, build with Sonar based on on-premise server - 10 minutes.
however, with Sonar on AzDO server I see a consistent picture: build goes much slower, by minute 20 it is 60% done but after that next Sonar upload task takes 40-50 minutes.
we added memory to build VM(16->32GB), and added memory to Sonar Server (8->16GB) - no any improvements.
what can I do?

2022-08-17T17:24:57.5797702Z zzz.Services.Revenue.UnitTest
2022-08-17T17:24:57.5992179Z Sonar: (zzz.Services.Revenue.UnitTest.csproj) Project processed successfully
2022-08-17T17:24:58.5742212Z zzz.Services.Framework.UnitTest
2022-08-17T17:24:58.5951096Z Sonar: (zzz.Services.Framework.UnitTest.csproj) Project processed successfully

2022-08-17T17:57:56.0777669Z ##[warning]Source\zzz\Services\zzz.Services.Cms\Managers\BeqManager.cs(820,15): Warning S1135: Complete the task associated to this ‘TODO’ comment.

Hi,

Can you upgrade to the latest version and see if this persists? SonarQube 9.6 was announced on Monday.

 
Ann

i’m trying to install Sonar96 with below commands:

> sc delete SonarQube
> $NEW_SONAR_HOME\bin\windows-x86-64\SonarService.bat install

i’ve setup environment variable “sonar_java_path” but sill getting the error below

2022-08-22 17:13:51,757 DEBUG - Starting WinSW in service mode
2022-08-22 17:13:51,773 INFO - Starting %JAVA_EXE% -Xms8m -Xmx32m -Djava.awt.headless=true --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -cp “…....\lib\sonar-application-9.6.0.59041.jar” “org.sonar.application.App”
2022-08-22 17:13:51,788 ERROR - Failed to start service.
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

what else i’m missing?

thank you,

Hi,

You’ve hit this:

SONAR-17224 SonarQube can’t start as a Windows Service

There’s a workaround in the ticket.

 
Ann

that particular error is fixed with workaround, service still failing:



2022.08.24 02:40:24 DEBUG web[][jdk.event.security] SecurityPropertyModification: key:networkaddress.cache.ttl, value:30
2022.08.24 02:40:24 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2022.08.24 02:40:25 DEBUG web[][o.s.c.a.AnnotationConfigApplicationContext] Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@592e843a
2022.08.24 02:40:25 DEBUG web[][o.s.c.p.PriorityBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
2022.08.24 02:40:25 DEBUG web[][o.s.c.p.PriorityBeanFactory] Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'
2022.08.24 02:40:25 DEBUG web[][o.s.c.p.PriorityBeanFactory] Creating shared instance of singleton bean 'jdk.internal.loader.ClassLoaders$AppClassLoader@5c29bfd-org.sonar.core.platform.LazyUnlessStartableStrategy-org.sonar.core.platform.LazyUnlessStartableStrategy@ec0c838AYLNuPAm5-Iw6ZdubSSy'
2022.08.24 02022.08.24 02:40:26 DEBUG web[][jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:7b05b1d449685144f7c989d29c199d12, Subject:CN=Symantec SHA256 TimeStamping CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US, Issuer:CN=VeriSign Universal Root Certification Authority, OU="(c) 2008 VeriSign, Inc. - For authorized use only", OU=VeriSign Trust Network, O="VeriSign, Inc.", C=US, Key type:RSA, Length:2048, Cert Id:679469769, Valid from:1/12/16, 12:00 AM, Valid until:1/11/31, 11:59 PM
2022.08.24 02:40:26 DEBUG web[][jdk.event.security] X509Certificate: Alg:SHA256withRSA, Serial:7bd4e5afbacc073fa101230422414d12, Subject:CN=Symantec SHA256 TimeStamping Signer - G3, OU=Symantec Trust Network, O=Symantec Corporation, C=US, Issuer:CN=Symantec SHA256 TimeStamping CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US, Key type:RSA, Length:2048, Cert Id:-1917605033, Valid from:12/23/17, 12:00 AM, Valid until:3/22/29, 11:59 PM
2022.08.24 02:40:26 DEBUG web[][c.m.s.jdbc.Driver] Microsoft JDBC Driver 10.2.1.0 for SQL Server
2022.08.24 02:40:26 DEBUG web[][jdk.event.security] X509Certificate: Alg:SHA1withRSA, Serial:2205b87fe224ae9e4d1652dc2761dbec, Subject:CN=SSL_Self_Signed_Fallback, Issuer:CN=SSL_Self_Signed_Fallback, Key type:RSA, Length:2048, Cert Id:-1246171640, Valid from:8/23/22, 4:07 PM, Valid until:8/23/52, 4:07 PM
2022.08.24 02:40:26 WARN  web[][o.s.c.a.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@5c29bfd-org.sonar.db.DefaultDatabase': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Fail to connect to database
2022.08.24 02:40:26 ERROR web[][o.s.s.p.PlatformImpl] Web server startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdk.internal.loader.ClassLoaders$AppClassLoader@5c29bfd-org.sonar.db.DefaultDatabase': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Fail to connect to database
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)

	at org.sonar.server.app.WebServer.start(WebServer.java:55)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
	at org.sonar.server.app.WebServer.main(WebServer.java:104)
Caused by: java.lang.IllegalStateException: Fail to connect to database
	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:86)
	at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
	... 44 common frames omitted
Caused by: java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:118)
	at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:83)
	... 48 common frames omitted
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:9699b537-f209-4860-a570-7e388738a718)
	at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:653)
	at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:531)
	at org.apache.commons.dbcp2.BasicDataSource.lambda$getConnection$0(BasicDataSource.java:720)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:722)
	at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
	at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)
	at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:115)
	... 49 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:9699b537-f209-4860-a570-7e388738a718
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680)
......
	... 56 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
.....
	... 65 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
.....
	... 77 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
	... 85 common frames omitted
2022.08.24 02:40:26 DEBUG web[][o.s.s.a.TomcatAccessLog] Tomcat is started
2022.08.24 02:40:26 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9090
2022.08.24 02:40:26 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2022.08.24 02:40:26 DEBUG web[][o.s.s.a.TomcatAccessLog] Tomcat is stopped

Hi,

This is about your certificate.

 
Ann

Hey there.

Make sure you read the upgrade notes

Microsoft SQL Server changes in configuration and Integrated Authentication

  • If your Microsoft SQL Server doesn’t support encryption, you will need to add encrypt=false to the JDBC URL connection string. (SONAR-16249).
  • If your Microsoft SQL Server requires encryption but you don’t want SonarQube to validate the certificate, you will need to add trustServerCertificate=true to the JDBC URL connection string.

Hi Colin
thank you for your help, I was able to start SonarQ96

Hi Ann
I’ve done with Sonar96. The long pipeline build issue got fixed with Sonar’s upgrade.
thank you so much for the help

2 Likes