Skip to content

Potential UI Thread Blocking Issues #362

@nbd-boss

Description

@nbd-boss

DNSFilterService.java – onDestroy() → shutdown()

onDestroy() is invoked on the main thread. Inside this method, shutdown() is called synchronously, and shutdown() itself contains several operations that may be heavy or slow, such as:

  • runningVPN.stop(true)
  • DNSFILTERPROXY.stop()
  • dnsReqForwarder.clearForward()
  • clearPortRedir()
    These operations likely involve VPN teardown, proxy shutdown, port cleanup, and other tasks that may take noticeable time. Executing them on the main thread could block the UI. So it is recommended to move it off the UI thread.

BootUpReceiver.java – onReceive() → getConfig()

onReceive() always runs on the main thread. getConfig() performs disk I/O when loading configuration files, which can block the main thread. According to Android’s official guidelines, file I/O should not be done on the UI thread.

DNSProxyActivity.java – onActivityResult() → onBackupRestore()

onBackupRestore() performs:

  • File I/O
  • ZIP compression/decompression
    These are typical long-running operations. Since onActivityResult() runs on the main thread, executing them synchronously may cause noticeable UI freezes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions