Skip to content

Fix lock deadlocks, production NPE, connection leaks, and log typo#539

Open
kasnder wants to merge 1 commit intomasterfrom
claude/code-review-xZGDx
Open

Fix lock deadlocks, production NPE, connection leaks, and log typo#539
kasnder wants to merge 1 commit intomasterfrom
claude/code-review-xZGDx

Conversation

@kasnder
Copy link
Copy Markdown
Member

@kasnder kasnder commented Apr 3, 2026

  • 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

- 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
@kasnder kasnder force-pushed the claude/code-review-xZGDx branch from fb953b8 to f54a96c Compare April 5, 2026 13:52
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