Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkstyle randomly exits when working on multiple projects #32

Open
PenghaiZhang opened this issue Apr 27, 2019 · 1 comment
Open

Checkstyle randomly exits when working on multiple projects #32

PenghaiZhang opened this issue Apr 27, 2019 · 1 comment

Comments

@PenghaiZhang
Copy link

PenghaiZhang commented Apr 27, 2019

Hi,

I am using this plugin on my project which has quite a lot sub-projects.
So the issue is after I type sbt checkstyle, it exits sbt in random number of sub-projects, or work very well sometimes.
Working well refers to it can generate reports for all sub-projects.
It seems like this plugin randomly picks up a sub-project to work and exits SBT with unknown reasons.
Any ideas about how to fix it is really appreciated!

@zsxwing
Copy link

zsxwing commented Nov 23, 2021

Hitting this issue as well. I think the root cause is noExit is not thread-safe. One thread can set the security manager back to the original one while another thread is in CheckstyleMain and calling System.exit.

Most of our projects have 0 java files. So CheckstyleMain will always fail and call System.exit for such projects. Looks like sbt-checkstyle uses NoExitSecurityManager to prevent System.exit from exiting the JVM to allow such case. But due to the above race condition, sbt-checkstyle randomly exits SBT JVM when such projects (0 java files) exist.

Our workaround is disabling parallel execution for SBT:

concurrentRestrictions in Global := {
  Tags.limitAll(1) :: Nil
}

Alternatively, you can disable checkstyle for projects that have 0 java files if your issue is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants