apache / apache/netbeans

NetBeans editor ends up deadlocked while editing layer.xml

Open
#8,510 0 comments 0 reactions 0 assignees View on GitHub
Editor kind:bug needs:triage Platform
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 25

### What happened

NetBeans IDE ends up deadlocked randomly, while editing layer.xml using the Projects view while the file is open in the editor.

### Language / Project Type / NetBeans Component

NetBeans Platform Application, Maven

### How to reproduce

1. Create a NetBeans Platform application
2. Add a layer.xml file to a module (e.g. branding) using the wizards
3. In the Projects view, open module -> Important Files -> XML Layer ->
4. Start deleting stuff while the layer.xml file is open in the editor
5. Randomly, the IDE ends up deadlocked

Based on the stack trace it looks like the layer.xml file being open in the editor is the important factor in this:
```
"AWT-EventQueue-0" #52 [12160] prio=6 os_prio=0 cpu=28000.00ms elapsed=1538.13s tid=0x000001d35b221040 nid=12160 in Object.wait() [0x0000008c9abfe000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait0(java.base@23.0.2/Native Method)
- waiting on
at java.lang.Object.wait(java.base@23.0.2/Object.java:378)
at java.lang.Object.wait(java.base@23.0.2/Object.java:352)
at javax.swing.text.AbstractDocument.readLock(java.desktop@23.0.2/AbstractDocument.java:1421)
- locked <0x000000060f4becb8> (a org.netbeans.modules.editor.NbEditorDocument)
at org.netbeans.api.editor.caret.EditorCaret$7.run(EditorCaret.java:1922)
at org.netbeans.api.editor.caret.EditorCaret.dispatchUpdate(EditorCaret.java:1938)
at org.netbeans.api.editor.caret.EditorCaret.runTransaction(EditorCaret.java:1671)
at org.netbeans.api.editor.caret.EditorCaret.setDot(EditorCaret.java:577)
at org.netbeans.api.editor.caret.EditorCaret.setDot(EditorCaret.java:546)
at javax.swing.text.JTextComponent.setCaretPosition(java.desktop@23.0.2/JTextComponent.java:1687)
at org.openide.text.DocumentOpenClose$DocumentLoad$1.run(DocumentOpenClose.java:793)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.lambda$doEventRequest$1(NbMutexEventProvider.java:112)
at org.netbeans.modules.openide.util.NbMutexEventProvider$Event$$Lambda/0x000001d3112659b8.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(java.desktop@23.0.2/InvocationEvent.java:318)
at java.awt.EventQueue.dispatchEventImpl(java.desktop@23.0.2/EventQueue.java:773)
at java.awt.EventQueue$4.run(java.desktop@23.0.2/EventQueue.java:720)
at java.awt.EventQueue$4.run(java.desktop@23.0.2/EventQueue.java:714)
at java.security.AccessController.executePrivileged(java.base@23.0.2/AccessController.java:778)
at java.security.AccessController.doPrivileged(java.base@23.0.2/AccessController.java:400)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@23.0.2/ProtectionDomain.java:87)
at java.awt.EventQueue.dispatchEvent(java.desktop@23.0.2/EventQueue.java:742)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@23.0.2/EventDispatchThread.java:203)
at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@23.0.2/EventDispatchThread.java:124)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@23.0.2/EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@23.0.2/EventDispatchThread.java:109)
at java.awt.EventDispatchThread.pumpEvents(java.desktop@23.0.2/EventDispatchThread.java:101)
at java.awt.EventDispatchThread.run(java.desktop@23.0.2/EventDispatchThread.java:90)
```
Full thread dump:
[threaddump-1747609897170.txt](https://github.com/user-attachments/files/20275462/threaddump-1747609897170.txt)

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 11

### JDK

Java: version 23.0.2 2025-01-21, vendor Azul Systems, Inc.

### Apache NetBeans packaging

Third-party package

### Anything else

Occurs randomly, but pretty consistently at least on my system. I remember having this issue like a year ago already, so it's been there for a while.

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Reproduce the deadlock by editing layer.xml from the Projects view while it is open in the editor. Start with the stack-trace entry points DocumentOpenClose, EditorCaret, and NbEditorDocument, and use the attached full thread dump to understand the lock cycle. Done means the described deletion workflow no longer deadlocks the IDE.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.