question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Can't remove document listener` error on editor close

See original GitHub issue

Describe the bug

Sometimes when i close editor with file, connected to lang server, I see Can't remove document listener error

To Reproduce Steps to reproduce the behavior:

Can’t make a reproducable scenario, but it’s something like - start idea, open file, close file 😃

Expected behavior

No errors, yay!

Stack trace

java.lang.Throwable: Can't remove document listener (com.github.lsp4intellij.editor.listeners.DocumentListenerImpl@793a7856). Registered listeners: [com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl$1@4b9e5316, 29, 0, Multicaster, 13, 307, 74, 0, 0, 83, 48, 0, 0, [], com.intellij.openapi.editor.impl.view.LogicalPositionCache@131df56e, com.intellij.openapi.editor.impl.view.TextLayoutCache@5e8a6c24, com.intellij.openapi.editor.ex.util.LexerEditorHighlighter(org.antlr.jetbrains.adapter.lexer.AntlrLexerAdapter): '...
...text of my file...
', 
use soft wraps: false, tab width: 4, additional columns: false, update in progress: false, bulk update in progress: false, dirty: true, deferred regions: []
appliance manager state: recalculation in progress: false; event being processed: null, available width: 1755, visible width: 0, dirty: true
soft wraps mapping info: Soft wraps affected by current update: []
soft wraps: [], com.intellij.openapi.editor.impl.view.EditorSizeManager@52b777c9, com.intellij.openapi.editor.impl.CaretModelImpl@468950da, com.intellij.openapi.editor.impl.InlayModelImpl$1@4889c412, com.intellij.openapi.editor.impl.EditorImpl$EditorDocumentAdapter@33c7b1ff, Multicaster, com.intellij.openapi.fileEditor.impl.text.TextEditorComponent$MyDocumentListener@19158719, com.intellij.openapi.editor.impl.ScrollingModelImpl$1@202a61ce, com.intellij.openapi.vcs.ex.DocumentTracker$MyDocumentListener@2685988d, com.intellij.openapi.vcs.ex.PartialLocalLineStatusTracker$MyUndoDocumentListener@28c39deb]
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:134)
	at com.intellij.openapi.editor.impl.DocumentImpl.removeDocumentListener(DocumentImpl.java:994)
	at com.github.lsp4intellij.editor.EditorEventManager.removeListeners(EditorEventManager.java:993)
	at com.github.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper.lambda$disconnect$2(LanguageServerWrapper.java:351)
	at java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1597)
	at com.github.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper.disconnect(LanguageServerWrapper.java:349)
	at com.github.lsp4intellij.client.languageserver.wrapper.LanguageServerWrapper.disconnect(LanguageServerWrapper.java:578)
	at com.github.lsp4intellij.IntellijLanguageClient.lambda$editorClosed$1(IntellijLanguageClient.java:185)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	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)

Desktop (please complete the following information):

  • OS: Windows 10 Pro x64
  • Browser Chrome
  • Version 73.0.3683.86

do you really need info about browser in this bug report? 😃

Additional context

After reopening files I see this exceptions in idea.log:

com.intellij.openapi.util.TraceableDisposable$DisposalException: Editor is already disposed
	at com.intellij.openapi.util.TraceableDisposable.throwDisposalError(TraceableDisposable.java:101)
	at com.intellij.openapi.editor.impl.EditorImpl.throwDisposalError(EditorImpl.java:936)
	at com.intellij.openapi.editor.impl.view.LogicalPositionCache.checkDisposed(LogicalPositionCache.java:193)
	at com.intellij.openapi.editor.impl.view.LogicalPositionCache.getLineInfo(LogicalPositionCache.java:178)
	at com.intellij.openapi.editor.impl.view.LogicalPositionCache.logicalPositionToOffset(LogicalPositionCache.java:112)
	at com.intellij.openapi.editor.impl.view.EditorCoordinateMapper.logicalPositionToOffset(EditorCoordinateMapper.java:91)
	at com.intellij.openapi.editor.impl.view.EditorView.logicalPositionToOffset(EditorView.java:161)
	at com.intellij.openapi.editor.impl.EditorImpl.logicalPositionToOffset(EditorImpl.java:2137)
	at com.github.lsp4intellij.utils.DocumentUtils.lambda$LSPPosToOffset$4(DocumentUtils.java:120)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:959)
	at com.github.lsp4intellij.utils.ApplicationUtils.computableReadAction(ApplicationUtils.java:32)
	at com.github.lsp4intellij.utils.DocumentUtils.LSPPosToOffset(DocumentUtils.java:109)
	at com.github.lsp4intellij.contributors.inspection.LSPInspection.descriptorsForManager(LSPInspection.java:90)
	at com.github.lsp4intellij.contributors.inspection.LSPInspection.checkFile(LSPInspection.java:64)
	at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:141)
	at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:70)
	at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:75)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$null$7(LocalInspectionsPass.java:316)
	at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:168)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:126)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:115)
	at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:110)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$8(LocalInspectionsPass.java:315)
	at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:133)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1163)
	at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:105)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
	at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:116)
	at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:96)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
	at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:96)
	at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.pollAndExecCC(ForkJoinPool.java:1190)
	at java.util.concurrent.ForkJoinPool.helpComplete(ForkJoinPool.java:1879)
	at java.util.concurrent.ForkJoinPool.awaitJoin(ForkJoinPool.java:2045)
	at java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.java:390)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:719)
	at java.util.concurrent.ForkJoinPool.invoke(ForkJoinPool.java:2616)
	at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:65)
	at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:56)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitRestElementsAndCleanup(LocalInspectionsPass.java:328)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:199)
	at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:115)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:423)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1168)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:416)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:415)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:391)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
NipunaRanasinghecommented, Mar 29, 2019

@nixel2007 Sorry for the late response since I’ve missed this somehow 😦 I could reproduce the issue on Ubuntu as well. I already fixed the Editor is already disposed issue and working on the document listener fix.

0reactions
NipunaRanasinghecommented, May 13, 2019

Closing since fixed by #75.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing an anonymous event listener - Stack Overflow
There is no way to cleanly remove an event handler unless you stored a reference to the event handler at creation.
Read more >
"Can't remove document listener" on tab close #1222 - GitHub
Repro steps: Have an existing project with some designs; Open the project in IDEA. Close all file editors, if any are open.
Read more >
Remove an Event Handler - JavaScript Tutorial
This tutorial shows you how to use the removeEventListener() method to remove an event handler from an event of an element.
Read more >
Manually removing the Security Agent - Worry-Free Business ...
To manually uninstall the Security Agent: Open the Microsoft Windows Services console and stop the following services: Trend Micro Security Agent Listener ......
Read more >
The Action Cannot Be Completed Because the File is Open: Fix
Read on to see how to delete a file when you get the action cannot be completed because the file is open in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found