Sonarlint crashes after analyzing file

I am facing the problem of sonarlint crashing after trying to analyse a file in vsCode and webStorm.

I have configured connection to my https://sonarqube.fooBar.com/, added token, made project binding.

The plugin starts, synchronised the settings for my project and started the file analysis, however after that I encountered an error:

[Info - 09:33:33:33.262] Analyzing file "file:///Users/fooBar/fooBarFile"...
[Info  - 09:33:40.309] Found 0 issues
Error - 09:34:33.472] Stream failed
[Error - 09:34:33.473] org.apache.hc.core5.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
    at org.apache.hc.core5.http.impl.nio.ChunkDecoder.readChunkHead(ChunkDecoder.java:138)
    at org.apache.hc.core5.http.impl.nio.ChunkDecoder.read(ChunkDecoder.java:205)
    at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onInput(AbstractHttp1StreamDuplexer.java:322)
    at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.inputReady(AbstractHttp1IOEventHandler.java:64)
    at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.inputReady(ClientHttp1IOEventHandler.java:41)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession.decryptData(SSLIOSession.java:624)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession.access$200(SSLIOSession.java:74)
    at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.inputReady(SSLIOSession.java:202)
    at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:142)
    at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
    at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
    at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
    at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
    at java.base/java.lang.Thread.run(Unknown Source)

What could the error be related to?

im using Mac os m2 pro with vscode-insiders/extensions/sonarsource.sonarlint-vscode-4.1.0-darwin-arm64/jre/21.0.1-macosx-aarch64.tar/bin/java -jar

Hello, welcome to the community! And thank you for reporting this.

As far as I can tell from the stack trace, this seems related to the low-level HTTP library that SonarLint uses to query the SonarQube server. However, in recent experience, instances of ConnectionClosedException are very hard to reproduce and investigate.

Could you please clarify what you mean by “sonarlint crashing”? Is the SonarLint language server process crashing in VSCode, or is it only logging the stack trace mentioned below?

Is this happening for each file that you try to open, or only on a specific file?

Is this behavior completely preventing analysis, or are issues found on some files?

It seems to me that the stack trace is truncated and does not contain anything related to SonarLint; would it be possible for you to enable verbose logging and share here a full extract of the “SonarLint Output”?

Thanks!

2 Likes

Hello! Ty for answer.

Could you please clarify what you mean by “sonarlint crashing”? Is the SonarLint language server process crashing in VSCode, or is it only logging the stack trace mentioned below?

No VSCode works fine, I did not express myself accurately, when I said crash, I meant that the process of analysing files each times ends with an error.

Is this happening for each file that you try to open, or only on a specific file?

Is this happening for each file

Is this behavior completely preventing analysis, or are issues found on some files?

Is this behavior completely preventing analysis, I don’t see sonar rule violations where they should be in my files.

It seems to me that the stack trace is truncated and does not contain anything related to SonarLint; would it be possible for you to enable verbose logging and share here a full extract of the “SonarLint Output”?

Sure, im attaching log file.
log.log (59.7 KB)

Hey :wave: thanks for the additional info!

I noticed a few interesting bits in it.

  • As far as I can tell, the analysis runs correctly; the line that starts the analysis is this one:
[Info  - 15:03:31.461] Analyzing file "file:///Users/username/Desktop/test/test.js"...

And the one that is logged at the end of the analysis is the following one:

[Info  - 15:03:35.645] Found 0 issues

And I don’t see any exceptions logged during the analysis (between these lines) - so far, so good :slight_smile:

  • The server that you are connecting to advertises an old, unsupported version (9.4.0.54424); if possible, I would strongly suggest that you update it (or request an update from your IT department) to at least 9.9.3 LTS, or even to the very recent 10.3 if you don’t need to stick to LTS versions.

  • The reported exception seems related to the server-sent events stream that SonarQube uses to notify SonarLint of changes in configuration and issue status; as far as I can tell, it should not cause any issue with the analysis itself (although the exception is arguably pretty noisy here).

Would it be possible for you to share (maybe in a private message) the contents of the test.js file?

I would also be interested in which rules are enabled in the JavaScript quality profile used by the fooBarprojectKey project, and which issues you expect to see in test.js.

1 Like

Jean, ty again for answer. After reading your post, I decided to check the plugin in the project again and was surprised to find out that in some files sonarlint really works (as it turned out, before I was just unlucky to get to files in which sonarlint worked).

What I noticed. Is that I have a tsx file with some code that is highlighted in sonarqube:

but the rule doesn’t work in IDE:

However, if I create a variable in the same file that contains nested ternary, I see a rule error:

I get the impression that the sonarlint plugin analysis works smarter than the sonarqube analysis, because the first example is not quite the same as the second. Am I right and can this be due to an outdated server version?

Hey, thanks for coming back with the details!

Indeed, the version of the JS/TS analyzer embedded in the current versions of SonarLint is more recent than the one that was shipped with SonarQube 9.4 :slight_smile: and IIRC there has been some work recently to lower the noise specifically on rules that target React.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.