Skip to content

Fix deadlock on unloading LSP module#2961

Merged
rchl merged 2 commits into
mainfrom
fix/deadlock
Jun 18, 2026
Merged

Fix deadlock on unloading LSP module#2961
rchl merged 2 commits into
mainfrom
fix/deadlock

Conversation

@rchl

@rchl rchl commented Jun 17, 2026

Copy link
Copy Markdown
Member

On unloading LSP module (when saving LSP.boot, for example), ST re-creates all ViewEventListeners referenced from that module. That should result in old instances being garbage collected but in our case DocumentSyncListener was not deleted because settings.add_on_change listener added in DocumentSyncListener.__init__ was not unregistered so it held a strong reference to DocumentSyncListener. That resulted in a deadlock in some conditions (related bug report: sublimehq/sublime_text#6868).

Go through all view listeners on LSP's plugin_unload and call our DocumentSyncListener.before_destroy() so that the settings listener is unregistered which then allows the instance to be GCed.

Also go through ClientConfigs' newly added remove_all_configs() to unregister settings listeners for removed configs instead of just clearing internal lists.

@rchl rchl merged commit 477284e into main Jun 18, 2026
9 checks passed
@rchl rchl deleted the fix/deadlock branch June 18, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants