Fix lock deadlocks, production NPE, connection leaks, and log typo#539
Open
Fix lock deadlocks, production NPE, connection leaks, and log typo#539
Conversation
- Wrap all lock.readLock/writeLock operations in try-finally blocks in ServiceSinkhole to prevent permanent deadlocks if exceptions occur while locks are held (e.g. during DB access in blockKnownTracker). Also fixes prepareHostsBlocked where unlock() ran unconditionally even when the lock was never acquired due to early return. - Replace disabled assert + chained NPE in tracker logcat logging: assert is a no-op in production Android, and ipToHost.get(daddr) can return null, causing a crash when log_logcat is enabled. - Fix copy-paste bug in ActivityMain.onActivityResult logging requestCode instead of resultCode. - Add HttpURLConnection.disconnect() in finally blocks in Common.kt and Util.java to prevent socket leaks on repeated network calls. - Move svg.renderToPicture() off the main thread in CountriesFragment; it was executing inside View.post() which runs on the UI thread. https://claude.ai/code/session_011HzyMPo2gd34cnXG4EWLYj
fb953b8 to
f54a96c
Compare
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.
ServiceSinkhole to prevent permanent deadlocks if exceptions occur
while locks are held (e.g. during DB access in blockKnownTracker).
Also fixes prepareHostsBlocked where unlock() ran unconditionally
even when the lock was never acquired due to early return.
assert is a no-op in production Android, and ipToHost.get(daddr)
can return null, causing a crash when log_logcat is enabled.
requestCode instead of resultCode.
and Util.java to prevent socket leaks on repeated network calls.
it was executing inside View.post() which runs on the UI thread.
https://claude.ai/code/session_011HzyMPo2gd34cnXG4EWLYj