Skip to content

Run OrbotService and TorService in single process#1666

Open
syphyr wants to merge 1 commit intoguardianproject:masterfrom
syphyr:single_process
Open

Run OrbotService and TorService in single process#1666
syphyr wants to merge 1 commit intoguardianproject:masterfrom
syphyr:single_process

Conversation

@syphyr
Copy link
Copy Markdown
Contributor

@syphyr syphyr commented Apr 19, 2026

When using power user mode and not setting battery optimization exemption (may drain the battery), this helps Orbot from being killed by Android for the following reasons:

  1. Reduces memory footprint (one process instead of two)
  2. Makes the service appear as a single, larger component to the OS
  3. Eliminates the overhead of inter-process communication

Android's process killer considers:

  • Total memory usage
  • Number of active processes
  • Process importance (foreground vs background)

By combining:

  • You halve the process count
  • The unified service can more easily maintain foreground priority
  • The OS sees one "important" service rather than two separate ones

When using power user mode and not setting battery
optimization exemption, this helps Orbot from being killed by
Android for the following reasons:

1. Reduces memory footprint (one process instead of two)
2. Makes the service appear as a single, larger component to the OS
3. Eliminates the overhead of inter-process communication

Android's process killer considers:
- Total memory usage
- Number of active processes
- Process importance (foreground vs background)

By combining:
- You halve the process count
- The unified service can more easily maintain foreground priority
- The OS sees one "important" service rather than two separate ones
@syphyr
Copy link
Copy Markdown
Contributor Author

syphyr commented Apr 20, 2026

Consider the following test case:

  1. Start Orbot in power user mode.
  2. Configure Tor Browser to use Orbot as an external Tor source in about:config with socks address and port. Note: Regular Firefox can also be used to test this, but Tor Browser is probably better because it is setup not to leak connections.
    a) chrome://geckoview/content/config.xhtml
    b) network.proxy.socks 127.0.0.1
    c) network.proxy.socks_port 9050
    d) extensions.torlauncher.start_tor false
    e) extensions.torlauncher.prompt_at_startup false
  3. Browse to a website that opens many connections, like cnn.com or imdb.com (make sure connections are not blocked with noscript).
  4. Orbot will get killed because of too many simultaneous connections.

Orbot no longer gets killed by Android when OrbotService and TorService run in a single process in this test case. Maybe because of the change in inter-process communication?

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.

1 participant