mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Do not break acquiring the write lock if the application is already being shut down.
Otherwise, this could lead to an inconsistent state and a deadlock: 1) startWrite() throws 2) endWrite() is never called 3) subsequent read waits forever IJ-MR-139088 GitOrigin-RevId: b59e0ebbf04bb0230b2267b88de6e04fa5956766
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8daf83926d
commit
ae53390ee5
+11
-1
@@ -9,6 +9,7 @@ import com.intellij.diagnostic.PluginException
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.openapi.application.*
|
||||
import com.intellij.openapi.application.ex.ApplicationUtil
|
||||
import com.intellij.openapi.diagnostic.ControlFlowException
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.progress.*
|
||||
import com.intellij.openapi.progress.util.PotemkinProgress
|
||||
@@ -501,7 +502,16 @@ internal object AnyThreadWriteThreadingSupport: ThreadingSupport {
|
||||
val t = System.currentTimeMillis()
|
||||
val permit = acquisitor()
|
||||
val elapsed = System.currentTimeMillis() - t
|
||||
WriteDelayDiagnostics.registerWrite(elapsed)
|
||||
try {
|
||||
WriteDelayDiagnostics.registerWrite(elapsed)
|
||||
}
|
||||
catch (thr: Throwable) {
|
||||
// we can be canceled here, it is an expected behavior
|
||||
if (thr !is ControlFlowException) {
|
||||
// Warn instead of error to avoid breaking acquiring the lock
|
||||
logger.warn("Failed to register write lock in diagnostics service", thr)
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled) {
|
||||
if (elapsed != 0L) {
|
||||
logger.debug("Write action wait time: $elapsed")
|
||||
|
||||
Reference in New Issue
Block a user