`Too many non-blocking read actions submitted at once. Please use coalesceBy, BoundedTaskExecutor...` when using `MavenDomUtil.createDomDependency`
Answered
I noticed in some case, IntelliJ report this error when adding Maven dependencies through `MavenDomUtil.
` :
java.lang.Throwable: Too many non-blocking read actions submitted at once. Please use coalesceBy, BoundedTaskExecutor or another way of limiting the number of concurrently running threads.: 11 with similar stack traces are currently active at com.intellij.openapi.
at my.code <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<diagnostic.Logger.error( Logger.java:182) at com.intellij.openapi. application.impl. SubmissionTracker. preventTooManySubmissions( SubmissionTracker.java:45) at com.intellij.openapi. application.impl. NonBlockingReadActionImpl$ Submission.<init>( NonBlockingReadActionImpl. java:231) at com.intellij.openapi. application.impl. NonBlockingReadActionImpl. submit( NonBlockingReadActionImpl. java:191) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeColl ector.amendStateInBackground( SuggestedRefactoringChangeColl ector.kt:94) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeColl ector.nextSignature( SuggestedRefactoringChangeColl ector.kt:42) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$MyDocumentListener. performWhenAllCommitted( SuggestedRefactoringChangeList ener.kt:288) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$MyDocumentListener. access$ performWhenAllCommitted( SuggestedRefactoringChangeList ener.kt:189) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$MyDocumentListener$ documentChanged$1.invoke( SuggestedRefactoringChangeList ener.kt:250) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$MyDocumentListener$ documentChanged$1.invoke( SuggestedRefactoringChangeList ener.kt:189) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$sam$java_lang_Runnable$0. run( SuggestedRefactoringChangeList ener.kt) at com.intellij.psi.impl. PsiDocumentManagerBase. performWhenAllCommitted( PsiDocumentManagerBase.java: 587) at com.intellij.psi.impl. PsiDocumentManagerBase. performWhenAllCommitted( PsiDocumentManagerBase.java: 577) at com.intellij.refactoring. suggested. SuggestedRefactoringChangeList ener$MyDocumentListener. documentChanged( SuggestedRefactoringChangeList ener.kt:250) at jdk.internal.reflect. GeneratedMethodAccessor114. invoke(Unknown Source) at java.base/jdk.internal. reflect. DelegatingMethodAccessorImpl. invoke( DelegatingMethodAccessorImpl. java:43) at java.base/java.lang.reflect. Method.invoke(Method.java:566) at com.intellij.util. EventDispatcher. dispatchVoidMethod( EventDispatcher.java:120) at com.intellij.util. EventDispatcher.lambda$ createMulticaster$1( EventDispatcher.java:85) at com.sun.proxy.$Proxy92. documentChanged(Unknown Source) at com.intellij.openapi.editor. impl.DocumentImpl. changedUpdate(DocumentImpl. java:917) at com.intellij.openapi.editor. impl.DocumentImpl.updateText( DocumentImpl.java:821) at com.intellij.openapi.editor. impl.DocumentImpl. replaceString(DocumentImpl. java:662) at com.intellij.openapi.editor. impl.DocumentImpl. replaceString(DocumentImpl. java:599) at com.intellij.psi.impl. PsiToDocumentSynchronizer. doCommitTransaction( PsiToDocumentSynchronizer. java:212) at com.intellij.psi.impl. PsiToDocumentSynchronizer. lambda$commitTransaction$1( PsiToDocumentSynchronizer. java:188) at com.intellij.psi.impl. PsiToDocumentSynchronizer. lambda$doSync$0( PsiToDocumentSynchronizer. java:106) at com.intellij.psi.impl. PsiToDocumentSynchronizer. performAtomically( PsiToDocumentSynchronizer. java:124) at com.intellij.psi.impl. PsiToDocumentSynchronizer. doSync( PsiToDocumentSynchronizer. java:106) at com.intellij.psi.impl. PsiToDocumentSynchronizer. commitTransaction( PsiToDocumentSynchronizer. java:188) at com.intellij.pom.core.impl. PomModelImpl. commitTransaction( PomModelImpl.java:197) at com.intellij.pom.core.impl. PomModelImpl.lambda$ runTransaction$1(PomModelImpl. java:152) at com.intellij.psi.impl. DebugUtil. performPsiModification( DebugUtil.java:481) at com.intellij.pom.core.impl. PomModelImpl.lambda$ runTransaction$2(PomModelImpl. java:104) at com.intellij.openapi.progress. impl.CoreProgressManager. lambda$ executeNonCancelableSection$3( CoreProgressManager.java:222) at com.intellij.openapi.progress. impl.CoreProgressManager. registerIndicatorAndRun( CoreProgressManager.java:698) at com.intellij.openapi.progress. impl.CoreProgressManager. computeUnderProgress( CoreProgressManager.java:646) at com.intellij.openapi.progress. impl.CoreProgressManager. computeInNonCancelableSection( CoreProgressManager.java:237) at com.intellij.openapi.progress. impl.CoreProgressManager. executeNonCancelableSection( CoreProgressManager.java:221) at com.intellij.pom.core.impl. PomModelImpl.runTransaction( PomModelImpl.java:93) at com.intellij.psi.impl.source. tree.ChangeUtil. prepareAndRunChangeAction( ChangeUtil.java:142) at com.intellij.psi.impl.source. tree.CompositeElement. replaceAllChildrenToChildrenOf (CompositeElement.java:641) at com.intellij.psi.impl.source. xml.XmlTextImpl.doSetValue( XmlTextImpl.java:168) at com.intellij.psi.impl.source. xml.XmlTextImpl.setValue( XmlTextImpl.java:160) at com.intellij.psi.impl.source. xml.XmlTagValueImpl.setText( XmlTagValueImpl.java:133) at com.intellij.psi.impl.source. xml.XmlTagValueImpl.setText( XmlTagValueImpl.java:108) at com.intellij.util.xml.impl. DomInvocationHandler. setTagValue( DomInvocationHandler.java:695) at com.intellij.util.xml.impl. DomInvocationHandler.lambda$ setValue$0( DomInvocationHandler.java:134) at com.intellij.util.xml.impl. DomManagerImpl.runChange( DomManagerImpl.java:297) at com.intellij.util.xml.impl. DomInvocationHandler.setValue( DomInvocationHandler.java:134) at com.intellij.util.xml.impl. SetInvocation.invoke( SetInvocation.java:47) at com.intellij.util.xml.impl. DomInvocationHandler.invoke( DomInvocationHandler.java:658) at com.intellij.util.xml. GenericDomValue$$ EnhancerByJetBrainsMainCglib$$ 2e754a1e.setStringValue(< generated>) at org.jetbrains.idea.maven.dom. MavenDomUtil. createDomDependency( MavenDomUtil.java:433) at com.intellij.openapi.command.
WriteCommandAction$ BuilderImpl.lambda$ doRunWriteCommandAction$1( WriteCommandAction.java:150) at com.intellij.openapi. application.impl. ApplicationImpl. runWriteAction( ApplicationImpl.java:947) at com.intellij.openapi.command. WriteCommandAction$ BuilderImpl.lambda$ doRunWriteCommandAction$2( WriteCommandAction.java:148) at com.intellij.openapi.command. impl.CoreCommandProcessor. executeCommand( CoreCommandProcessor.java:219) at com.intellij.openapi.command. impl.CoreCommandProcessor. executeCommand( CoreCommandProcessor.java:184) at com.intellij.openapi.command. WriteCommandAction$ BuilderImpl. doRunWriteCommandAction( WriteCommandAction.java:157) at com.intellij.openapi.command. WriteCommandAction$ BuilderImpl.run( WriteCommandAction.java:124)
...
However I am not really understanding what I am doing wrong here.
- There's this message `
11 with similar stack traces are currently active
` but the code is only adding 4 dependencies. - There's no immediate possibility with `
MavenDomUtil.
` to use eithercreateDomDependency coalesceBy
,BoundedTaskExecutor
at least to my understanding
I have seen this exception being raised in 2021.1.3 and the latest EAP 2021.3.
The action is still performed correctly however it raises a notification about this error.
Please sign in to leave a comment.
Please show/link your invocation code
Hi @...
Here's the code I am dealing with, the `
MavenDomUtil.createDomDependency
` is called in theaddDependency
method.These next line do do anything else. They receive a list of 4 coordinates (`List<MavenId> ids`), never more.
and the utility methods
It seems that wrapping the for loop in `ChangeUtil::prepareAndRunChangeAction` is the right thing to do