summary
SonarScanner CLI ends up with Exception in thread "main" java.lang.StackOverflowError
when scanning a python file.
which versions are you using
- SonarQube Server Enterprise Edition 10.8.1.101195
- SonarScanner CLI 7.0.2.4839
how is SonarQube deployed
- kubernetes/docker
what are you trying to achieve
- scan a python file
what have you tried so far to achieve this
- setup works with different python files than the one mentioned below (and other languages)
How to reproduce:
Scan a file test.py with the following content:
def _update_transfer(xfr, job):
job_status = job['status']
if xfr.pcs_status == job_status:
return
xfr.pcs_status = job_status
if job_status in ('NEW', 'REQUESTED', 'RUNNING'):
xfr.status = 'RUNNING'
elif job_status not in ('FINISHED', 'CANCELED', 'FAILED', 'EXPIRED'):
xfr.status = 'UNKNOWN'
else:
xfr.finished_at = _to_datetime('changeTimestamp')
if job_status == 'FINISHED':
xfr.status = 'SUCCESS'
xfr.pcs_message = (job.get('warningMessage') or '').strip()[:10000] or None
else:
xfr.status = 'CANCELED' if job_status == 'CANCELED' else 'FAILED'
xfr.pcs_message = (job.get('errorMessage') or '').strip()[:10000] or None
xfr.save()
Result
$ sonar-scanner -D"sonar.host.url=${SONAR_URL}" -D"sonar.login=${SONAR_TOKEN}"
16:20:21.728 INFO Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
16:20:21.731 INFO Project root configuration file: [redacted]/sonar-project.properties
16:20:21.741 INFO SonarScanner CLI 7.0.2.4839
16:20:21.742 INFO Java 17.0.13 Ubuntu (64-bit)
16:20:21.743 INFO Linux 5.4.0-204-generic amd64
16:20:21.763 WARN Both 'sonar.login' and 'sonar.token' (or the 'SONAR_TOKEN' env variable) are set, but only the latter will be used.
16:20:21.766 INFO User cache: /root/.sonar/cache
16:20:22.696 WARN Use of 'sonar.login' property has been deprecated in favor of 'sonar.token' (or the env variable alternative 'SONAR_TOKEN'). Please use the latter when passing a token.
16:20:22.696 INFO JRE provisioning: os[linux], arch[x86_64]
16:20:25.509 INFO Communicating with SonarQube Server 10.8.1.101195
16:20:25.714 INFO Starting SonarScanner Engine...
16:20:25.715 INFO Java 17.0.11 Eclipse Adoptium (64-bit)
16:20:26.449 INFO Load global settings
16:20:26.792 INFO Load global settings (done) | time=343ms
16:20:26.803 INFO Server id: [redacted]
16:20:26.813 INFO Loading required plugins
16:20:26.814 INFO Load plugins index
16:20:26.857 INFO Load plugins index (done) | time=43ms
16:20:26.857 INFO Load/download plugins
16:20:29.839 INFO Load/download plugins (done) | time=2983ms
16:20:30.057 INFO Loaded core extensions: developer-scanner, sca, server-common
16:20:30.251 INFO Process project properties
16:20:30.251 INFO Process project properties (done) | time=0ms
16:20:30.255 INFO Project key: [redacted]
16:20:30.256 INFO Base dir: [redacted]
16:20:30.256 INFO Working dir: [redacted]/.scannerwork
16:20:30.259 INFO Load project settings for component key: '[redacted]'
16:20:30.338 INFO Load project settings for component key: '[redacted]' (done) | time=78ms
16:20:30.353 INFO Load project branches
16:20:30.394 INFO Load project branches (done) | time=41ms
16:20:30.395 INFO Load branch configuration
16:20:30.395 INFO Detected branch/PR in 'GitLab'
16:20:30.396 INFO Auto-configuring branch 'main'
16:20:30.397 INFO Load branch configuration (done) | time=2ms
16:20:30.405 INFO Load quality profiles
16:20:30.480 INFO Load quality profiles (done) | time=74ms
16:20:30.484 INFO Auto-configuring with CI 'Gitlab CI'
16:20:30.527 WARN SCM-TFVC: Missing configuration for CollectionUri. The project may not receive blame information.
16:20:30.540 INFO Load active rules
16:20:33.763 INFO Load active rules (done) | time=3222ms
16:20:33.767 INFO Load analysis cache
16:20:33.797 INFO Load analysis cache (404) | time=29ms
16:20:33.853 INFO Branch name: main
16:20:33.854 WARN The property 'sonar.login' is deprecated and will be removed in the future. Please use the 'sonar.token' property instead when passing a token.
16:20:33.863 INFO Preprocessing files...
16:20:33.918 INFO 1 language detected in 3 preprocessed files
16:20:33.918 INFO 0 files ignored because of scm ignore settings
16:20:33.919 INFO Loading plugins for detected languages
16:20:33.919 INFO Load/download plugins
16:20:37.703 INFO Load/download plugins (done) | time=3784ms
16:20:37.784 INFO Load project repositories
16:20:37.803 INFO Load project repositories (done) | time=20ms
16:20:37.811 INFO Indexing files...
16:20:37.812 INFO Project configuration:
16:20:37.819 INFO 3 files indexed
16:20:37.820 INFO Quality profile for py: Sonar way
16:20:37.820 INFO ------------- Run sensors on module [redacted]
16:20:37.860 INFO Load metrics repository
16:20:37.873 INFO Load metrics repository (done) | time=13ms
16:20:38.372 INFO Sensor Python Sensor [python]
16:20:38.382 INFO Starting global symbols computation
16:20:38.385 INFO 1 source file to be analyzed
16:20:38.624 INFO 1/1 source file has been analyzed
16:20:38.637 INFO Starting rules execution
16:20:38.637 INFO 1 source file to be analyzed
16:20:39.144 ERROR [stderr] Exception in thread "main" java.lang.StackOverflowError
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.B(na:2262)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.A(na:2385)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.B(na:2599)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.A(na:2839)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.B(na:2599)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.A(na:2839)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.B(na:2599)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.A(na:2839)
16:20:39.145 ERROR [stderr] at com.sonarsource.dbd.A.A.H.B(na:2599)
[...]
16:20:39.486 INFO EXECUTION FAILURE
16:20:39.487 INFO Total time: 17.760s
Maybe this is related to #131311. However, we are not using cloud, but server edition.