Skip to content

IDEA dead lock when resources folder is removed before generation #1160

Closed
@alisevych

Description

@alisevych

Description

IDEA dead lock when resources folder is removed before generation.
In IDEA log there is the exception in open or create folder method.

To Reproduce

  1. Run the 'UTBotJava' project in IntelliJ Idea
  2. Delete test resources folder in utbot-samples module (in Project view)
  3. Use plugin to generate tests for StringExamples f.e.

Expected behavior

Test resource folder is supposed to be recreated for the SARIF report.

Actual behavior

After test generation is finished and test classes are being painted, IDEA comes into dead lock. Only kill process helps.

Visual proofs (screenshots, logs, images)

There is the following exception in idea.log

2022-10-13 17:16:24,499 [ 465238]   INFO - #c.i.u.i.RootChangesLogger - New rootsChanged event for "utbot" project with partial rescanning with trace_hash = 423762346:
java.lang.Throwable
	at com.intellij.util.indexing.RootChangesLogger.info(RootChangesLogger.java:27)
	at com.intellij.util.indexing.EntityIndexingServiceImpl.logRootChanges(EntityIndexingServiceImpl.java:108)
	at com.intellij.util.indexing.EntityIndexingServiceImpl.indexChanges(EntityIndexingServiceImpl.java:87)
	at com.intellij.openapi.roots.impl.ProjectRootManagerComponent.synchronizeRoots(ProjectRootManagerComponent.java:299)
	at com.intellij.openapi.roots.impl.ProjectRootManagerComponent.fireRootsChangedEvent(ProjectRootManagerComponent.java:212)
	at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.fireRootsChanged(ProjectRootManagerImpl.java:477)
	at com.intellij.openapi.roots.impl.ProjectRootManagerImpl$1.fireRootsChanged(ProjectRootManagerImpl.java:137)
	at com.intellij.openapi.roots.impl.ProjectRootManagerImpl$1.fireRootsChanged(ProjectRootManagerImpl.java:134)
	at com.intellij.openapi.roots.impl.ProjectRootManagerImpl$BatchSession.rootsChanged(ProjectRootManagerImpl.java:108)
	at com.intellij.workspaceModel.ide.impl.legacyBridge.watcher.RootsChangeWatcher$1.fireRootsChangeEvent(RootsChangeWatcher.kt:177)
	at com.intellij.workspaceModel.ide.impl.legacyBridge.watcher.RootsChangeWatcher$1.fireRootsChangeEvent$default(RootsChangeWatcher.kt:166)
	at com.intellij.workspaceModel.ide.impl.legacyBridge.watcher.RootsChangeWatcher$1$prepareChange$2.afterVfsChange(RootsChangeWatcher.kt:120)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport.afterVfsChange(AsyncEventSupport.java:133)
	at com.intellij.openapi.vfs.newvfs.AsyncEventSupport$1.after(AsyncEventSupport.java:65)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:649)
	at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:625)
	at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:470)
	at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:259)
	at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:425)
	at jdk.proxy2/jdk.proxy2.$Proxy192.after(Unknown Source)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.fireAfterEvents(PersistentFSImpl.java:1218)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.processEvent(PersistentFSImpl.java:851)
	at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.createChildDirectory(PersistentFSImpl.java:510)
	at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.createChildDirectory(VirtualFileSystemEntry.java:364)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:383)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:373)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:373)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:373)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:373)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:373)
	at com.intellij.openapi.vfs.VfsUtil.createDirectoryIfMissing(VfsUtil.java:357)
	at org.utbot.intellij.plugin.sarif.SarifReportIdea$createAndSave$1.invoke(SarifReportIdea.kt:31)
	at org.utbot.intellij.plugin.sarif.SarifReportIdea$createAndSave$1.invoke(SarifReportIdea.kt:31)
	at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt$sam$com_intellij_openapi_util_Computable$0.compute(ApplicationUtils.kt)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$13(ApplicationImpl.java:1032)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1011)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1032)
	at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt.runWriteAction(ApplicationUtils.kt:20)
	at org.utbot.intellij.plugin.sarif.SarifReportIdea.createAndSave(SarifReportIdea.kt:31)
	at org.utbot.intellij.plugin.generator.CodeGenerationController$saveSarifReport$$inlined$executeCommand$default$1.run(actions.kt:14)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.saveSarifReport(CodeGenerationController.kt:808)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.access$saveSarifReport(CodeGenerationController.kt:73)
	at org.utbot.intellij.plugin.generator.CodeGenerationController$generateCodeAndReport$1$1$1$2$1.run(CodeGenerationController.kt:616)
	at org.utbot.intellij.plugin.util.IntelliJApiHelper$run$$inlined$invokeLater$1.run(ApplicationUtils.kt:94)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:513)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:75)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:118)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:779)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:749)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:766)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Environment

Windows 10 Pro
IntelliJ IDEA 2022.2.3

Additional context

Originally posted by @alisevych in #1125 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions