Sonarqube扫描仪错误DirectoryNotEmptyException

时间:2018-07-10 07:46:42

标签: sonarqube sonarqube-scan

我正在Citrix远程计算机上使用sonarqube扫描仪。在扫描过程中,代码分析完成并被压缩。但是在上载此压缩文件时,我得到了java.nio.file.DirectoryNotEmptyException,但没有任何东西上载到sonarqube服务器。

请注意,扫描仪适用于小型项目。它不仅适用于大型项目。我的sonarqube版本是7.2.1。 6.7 LTS版本中发生了相同的事情。但是它在5.6 LTS版本中工作得很好。

我尝试在sonar.ws.timeout=9000文件中设置sonar-scanner.properties来增加时间。这没用。

错误消息是:

INFO: 7 files had no CPD blocks
INFO: Calculating CPD for 521 files
INFO: CPD calculation finished
INFO: Analysis report generated in 4886ms, dir size=15 MB
INFO: Analysis reports compressed in 3769ms, zip size=4 MB
ERROR: Failed to delete temp folder
java.nio.file.DirectoryNotEmptyException: C:\codeAnalyzer\bhatk\.scannerwork\.sonartmp
        at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProv
ider.java:266)
        at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSyst
emProvider.java:108)
        at java.nio.file.Files.deleteIfExists(Files.java:1165)
        at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileV
isitor.postVisitDirectory(DefaultTempFolder.java:121)
        at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileV
isitor.postVisitDirectory(DefaultTempFolder.java:110)
        at java.nio.file.Files.walkFileTree(Files.java:2688)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at org.sonar.api.utils.internal.DefaultTempFolder.clean(DefaultTempFolde
r.java:97)
        at org.sonar.api.utils.internal.DefaultTempFolder.stop(DefaultTempFolder
.java:106)
        at org.sonar.scanner.analysis.AnalysisTempFolderProvider.stop(AnalysisTe
mpFolderProvider.java:61)
        at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContai
ner.java:1048)
        at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java
:803)
        at org.sonar.core.platform.ComponentContainer.stopComponents(ComponentCo
ntainer.java:165)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:124)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:
81)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentC
ontainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer
.java:122)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContain
er.java:132)
        at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.exec
ute(BatchIsolatedLauncher.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(Iso
latedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner
.java:171)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.j
ava:128)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE  
INFO: ------------------------------------------------------------------------
INFO: Total time: 3:27.575s
INFO: Final Memory: 60M/2882M
INFO: -----------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Fail to request http://localhost:9000/api/ce/submit?projectKey=my:project
&projectName=My%20project
ERROR: Caused by: timeout
ERROR: Caused by: Socket closed
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging
.

1 个答案:

答案 0 :(得分:0)

从OkHttp库继承的默认10s writeTimeout导致的错误。虽然readTimeout可通过sonar.ws.timeout参数进行配置,但writeTimout当前不可配置。在某些情况下,取决于分析报告的大小和/或您的基础结构设置,10s不足以上传导致套接字超时错误和DirectoryNotEmptyException的分析报告。我已经实施了修复,并将其提交到SonarSource github:https://github.com/SonarSource/sonarqube/pull/3252/files