eclipse / tm4e

TextMate support in Eclipse IDE
https://projects.eclipse.org/projects/technology.tm4e
Eclipse Public License 2.0
79 stars 54 forks source link

org.eclipse.jface.text.BadLocationException #746

Closed kohlschuetter closed 2 months ago

kohlschuetter commented 2 months ago

Seen several times in the Eclipse error log (2024-06 M2):

org.eclipse.jface.text.BadLocationException
    at org.eclipse.jface.text.AbstractDocument.get(AbstractDocument.java:958)
    at org.eclipse.core.internal.filebuffers.SynchronizableDocument.get(SynchronizableDocument.java:130)
    at org.eclipse.tm4e.ui.internal.utils.MarkerUtils.updateTextMarkers(MarkerUtils.java:133)
    at org.eclipse.tm4e.ui.internal.utils.MarkerUtils.updateTextMarkers(MarkerUtils.java:64)
    at org.eclipse.tm4e.ui.text.TMPresentationReconciler.lambda$0(TMPresentationReconciler.java:120)
    at org.eclipse.tm4e.core.model.ModelTokensChangedEvent$Listeners.dispatchEvent(ModelTokensChangedEvent.java:60)
    at org.eclipse.tm4e.core.model.ModelTokensChangedEvent$Listeners.dispatchEvent(ModelTokensChangedEvent.java:1)
    at org.eclipse.tm4e.core.internal.utils.AbstractListeners.lambda$0(AbstractListeners.java:51)
    at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891)
    at java.base/java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:425)
    at org.eclipse.tm4e.core.internal.utils.AbstractListeners.dispatchEvent(AbstractListeners.java:51)
    at org.eclipse.tm4e.core.model.ModelTokensChangedEvent$Listeners.dispatchEvent(ModelTokensChangedEvent.java:70)
    at org.eclipse.tm4e.core.model.TMModel$TokenizerThread.revalidateTokens(TMModel.java:290)
    at org.eclipse.tm4e.core.model.TMModel$TokenizerThread.run(TMModel.java:172)
eclipse.buildId=4.32.0.20240502-0721
java.version=21.0.3
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=aarch64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -keyring /Users/ck/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch aarch64 -product org.eclipse.epp.package.jee.product -keyring /Users/ck/.eclipse_keyring
sebthom commented 2 months ago

BadLocationException happen when an update to a document occurred while code in a non-ui thread tries to query that document.

Without more context and a reproducible test case this is very difficult to resolve.

Are you facing an actual functional issue? If so, please describe it.

kohlschuetter commented 2 months ago

@sebthom Thanks for looking into this. I don't have more context, as this was a spurious error.

If this error message does not have enough information to debug the root cause, shouldn't it be amended with details, or perhaps just removed entirely?

sebthom commented 2 months ago

I had another look at the issue. At this point in time I don't want to suppress the logging of the exception as it looks like there is actually some kind of race condition that can be fixed. however I still don't know how to reproduce it.