fix(macos): stop polling VPNService.getStarted() every second on home screen - #1874
Open
david-build wants to merge 1 commit into
Open
fix(macos): stop polling VPNService.getStarted() every second on home screen#1874david-build wants to merge 1 commit into
david-build wants to merge 1 commit into
Conversation
…creen On macOS every getStarted()/getState() call goes through loadAllFromPreferences and creates NETunnelProviderSession objects that never get released. After a couple of days of uptime the UI process ends up with hundreds of thousands of live sessions (321904 measured with heap), and toggling the VPN then floods nesessionmanager with session info requests from the main thread. That is what freezes the whole system on connect/disconnect, see KaringX#1873. The urltest ticker already gets the state via _onStateChanged, so use the cached value instead of asking the plugin once per second.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1873.
On macOS every getStarted() call goes through loadAllFromPreferences and creates NE session objects, so the 1s urltest ticker adds constant churn on nesessionmanager. The state is already delivered to _onStateChanged, so just use the cached value.
Doesn't fix the session leak itself (that's in the vpn-service plugin, details in the issue), but removes the biggest steady source of it in the app.