SonarJava: StackOverflowError with squid:S2637

  • Versions used

    • latest sonarqube (7.3)
    • latest plugin SonarJava (5.7)
    • maven 3.5.2
  • Error observed:

    • “A stack overflow error occurred while analyzing file”
  • Steps to reproduce:

    • Configure a Quality Profile for Java including squid:S2637 ("@NonNull" values should not be set to null)
    • Clone the project here: https://github.com/seyguai/sonar-stackoverflow-s2637
    • Run ‘mvn compile sonar:sonar’
    • Boom. (part of the stack is available inside ./stack.txt)

Well, actually, I can’t reproduce the StackOverflowError every time, which is even worse.
I ran the maven command three times in a row, no error, went for a drink, came back, ran it once, and then it failed.
I sincerely hope the drink is not required to reproduce the problem.

Thanks,
Nicolas

1 Like

hello @n.boussuge,

sorry for the late reaction. I confirm that I managed to reproduce the issue also on the current version of sonar-java analyzer, however, it seems to be undeterministic, as you described. It will be hard to pinpoint the problem with the current implementation, I created the ticket https://jira.sonarsource.com/browse/SONARJAVA-3123, to make the behavior of the symbolic execution engine completely deterministic, so it will be easier to reproduce issues like this. However, applying this change makes the problem disappear (although it is not a real fix).