Skip to content

Document why the JVM does not exit after KotlinAnalysisIndexer.run - #1077

Closed
christoph-sg wants to merge 1 commit into
mainfrom
kotlin-analysis-exit-docs
Closed

christoph-sg wants to merge 1 commit into
mainfrom
kotlin-analysis-exit-docs

Conversation

@christoph-sg

Copy link
Copy Markdown
Member

Library users of scip-kotlin-analysis find that their JVM hangs after KotlinAnalysisIndexer.run() returns. KaFirSessionProvider creates IntelliJ's process-wide AppScheduledExecutorService, which immediately submits a task and keeps one non-daemon core thread alive for good. Its shutdown() refuses to run on the global pool, and forcing it via reflection would break later run() calls in the same process, which GradleBuildTool makes once per Kotlin config. Disposing the session in run() doesn't touch this pool. So this documents the explicit exitProcess requirement on the class and points the two existing exitProcess comments at the actual cause. No behavior change.

The Analysis API starts IntelliJ's process-wide application thread
pool, whose non-daemon core thread never stops and which cannot be
shut down without breaking later runs in the same process.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1ca08-3e68-7113-8182-d86a4ef63ea7
Co-authored-by: Amp <amp@ampcode.com>
@christoph-sg

Copy link
Copy Markdown
Member Author

Don't think this really helps.

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

Successfully merging this pull request may close these issues.

1 participant