IncorrectOperationException

Answered

I've had a bug reported by a couple of users where their IntelliJ instance will more or less lock up and require a restart. I've finally managed to reproduce part of it, which is the following exception. I tend to either suddenly get it 50 times or so, or it will happen repeatedly until I restart IntelliJ. I've looked at the code which throws it, and I'm not sure what's going on - it looks like some invariant is violated related to committing, something along the lines of that the previously committed text of the document is not equal to the text of the previous PSI tree, or something. Can anyone shed any light on what might cause this?

[22075917]  ERROR - .psi.impl.DocumentCommitThread -  
com.intellij.util.IncorrectOperationException: SingleRootFileViewProvider{myVirtualFile=file:///Users/colin/dev/cursive-bugs/cursive-1382/src/cursive_1382/foo.clj, content=com.intellij.psi.SingleRootFileViewProvider$PsiFileContent@4964e280}
    at com.intellij.psi.impl.source.text.BlockSupportImpl.makeFullParse(BlockSupportImpl.java:214)
    at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockSupportImpl.java:92)
    at com.intellij.psi.impl.DocumentCommitThread.doCommit(DocumentCommitThread.java:777)
    at com.intellij.psi.impl.DocumentCommitThread$6.run(DocumentCommitThread.java:579)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1064)
    at com.intellij.psi.impl.DocumentCommitThread.commitUnderProgress(DocumentCommitThread.java:594)
    at com.intellij.psi.impl.DocumentCommitThread.access$400(DocumentCommitThread.java:81)
    at com.intellij.psi.impl.DocumentCommitThread$2.run(DocumentCommitThread.java:414)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:472)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:421)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.psi.impl.DocumentCommitThread.pollQueue(DocumentCommitThread.java:411)
    at com.intellij.psi.impl.DocumentCommitThread.run(DocumentCommitThread.java:361)
    at com.intellij.util.concurrency.BoundedTaskExecutor.runFirstTaskThenPollAndRunRest(BoundedTaskExecutor.java:178)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$000(BoundedTaskExecutor.java:40)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:197)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

0
6 comments

not sure about what causes it however these methods may help:

PsiDocumentManager
hasUncommitedDocuments
commitAllDocuments
performWhenAllCommitted
0

Hi Colin,

we've seen such exceptions reported, but they remain a mystery so far. They indeed indicate that PSI text isn't equal to the one recorded as previously committed, but I don't yet know what can cause it. Either a PSI modification that went unnoticed by our framework for some reason, or a similar document modification. Or getText overridden in a faulty way.

Can you reproduce this reliably? If yes, we could think of a way to debug this.

1

Hi Peter, I believe I can reproduce it semi-reliably at least. I'll contact you directly to think about debugging this.

0

I am also experimenting such a problem in one plugin I am developing. Could you please share how you solved it?

0

Sergio, the OPs issue was caused by an NPE thrown from their custom tree change preprocessor right inside commitDocument. Since then, we've added some recovery from that situation, so you should also get some other exceptions. Or, it might be that you're having some completely different issue.

0

thanks for your answer Peter, I created a separate thread for that here: https://intellij-support.jetbrains.com/hc/en-us/requests/894298?page=1

Unfortunately, all the newlines were removed (I did not expect that to happen) so the messages I wrote after the code snippets are difficult to read.

0

Please sign in to leave a comment.