Geoffrey Challen
07/14/2023, 1:52 PMlint
and format
methods provided by the KtLintRuleEngine
are thread safe in 0.50.0
? We use these to check snippets as part of an internal tool. I was working on an upgrade this morning and was reminded that at present we're locking around these calls to prevent concurrent access, which I'm pretty sure was due to errors that we were experiencing on highly-concurrent workloads in the past. Curious whether this is known to have been resolved or whether it's tested as part of the standard ktlint
test suites.Paul Dingemans
07/14/2023, 6:29 PMGeoffrey Challen
07/16/2023, 8:10 PMktlintRuleEngine
directly, as of the recently-completed upgrade to the latest version.
I know that we ran into problems with checkstyle
(our tool does both Java and Kotlin analysis tasks). And I also believe that until recently ANTLR4 was known to not be thread-safe, although I believe that this was fixed recently. So it's possible that I noticed the checkstyle
errors and decided to proactively single-thread ktlint
just in case.
I'll restart our workload in the next few days and keep you posted. Thanks for all of the great work on ktlint
!wakingrufus
07/16/2023, 8:45 PMGeoffrey Challen
07/16/2023, 10:31 PMcheckstyle
which was known to be safe only failed a few times while processing ~800K small code snippets across 8 cores. So these are definitely low-probability events, and interspersed with much longer processing steps that probably make it unlikely for them to line up.