-
Notifications
You must be signed in to change notification settings - Fork 50
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
Run Kotlinter in process isolation #420
Conversation
First in a series of changes leading to a 5.0.0 release. Starting with Kotlin 2.1.0 it's no longer acceptable to run ktlint and the embedded Kotlin compiler in the main Gradle classloader. The solution is to use classloader Gradle worker isolation. Positive consequences: - Users can configure the version of ktlint - Kotlinter is compatible with any version of Kotlin with matching language specification Side effects to watch: - Performance may be slower - Potential [Gradle memory issues](gradle/gradle#18313)
Tested it on a substantial multi-module project with command
So it will be slower, but this is the cost of isolation. Incremental of course is still fast and under 1s because generally not many files change between runs. |
We do experience the classloader leak bug however.
This helps quite a bit, but even then if you repeat @osipxd you seem to have some insight here. Is the workaround to use process isolation instead of classloader? It seems like we could run into different problems there. |
I haven't investigated possible workarounds deeply myself. But I've seen another possible workaround by @martinbonnin: |
Switching to process isolation yields:
So it's actually better than classloader isolation, but still a small performance hit. |
Thanks for the quick response. It actually looks like process isolation is not bad and it fixes the issue. |
FWIW, we went the process isolation route before but that created other questions like how many processes can you run in parallel? What heap size to allocate in each process, etc... It can work (and from the issues linked in gradle/gradle#18313, looks like this is definitely a solution) but it's no silver bullet either. |
FYI, there is a pull request to fix this 🎉 : gradle/gradle#31654 |
First in a series of changes leading to a 5.0.0 release. Starting with Kotlin 2.1.0 it's no longer acceptable to run ktlint and the embedded Kotlin compiler in the main Gradle classloader. The solution is to use Gradle worker process isolation.
Positive consequences:
Side effects to watch: