Skip to content

Native thread exhaustion (pthread_create failed) with long-running root services (AdGuard) on Android 16 / OxygenOS #5995

@lenox108

Description

@lenox108

Please answer the following questions for yourself before submitting an issue

  • Filters were updated before reproducing an issue
  • I checked the knowledge base and found no answer
  • I checked to make sure that this issue has not already been filed

AdGuard version

Last

Environment

  • OS version:
  • Device:

HTTPS filtering

  • yes, I do

Root access

  • yes, I have it

Integration with AdGuard VPN

  • yes, I do

Routing mode

Automatic proxy

Ad Blocking

AdGuard Base filter

Privacy

EasyPrivacy

Social

No response

Annoyances

No response

Security

No response

Language-specific

No response

Other

No response

Which DNS server do you use?

DNS protection disabled

DNS protocol

None

Custom DNS

No response

What Stealth Mode options do you have enabled?

No response

Issue Details

Steps to reproduce:
1.## Problem
On Android 16 (OxygenOS, OnePlus device) KernelSU / KernelSU Next causes
native thread exhaustion for long-running root services.

After some time (usually several hours up to ~1 day), applications that run
as persistent root services fail with the following error:

OutOfMemoryError: pthread_create (4096–4112KB stack) failed

After this happens, the affected app cannot be launched again until it is
fully uninstalled and reinstalled.

This issue is reproducible with AdGuard in root mode, but AdGuard itself
is not the root cause — it is simply a reproducible example of a
long-running root daemon.


Environment

  • Device: OnePlus
  • Android version: Android 16
  • ROM: OxygenOS
  • Kernel: GKI-based kernel with KernelSU / KernelSU Next
  • Root manager: KernelSU Next (also reproducible with Wild KSU)
  • Root mode: enabled
  • Mount namespace: tested (inherited / private)
  • SUSFS / Zygisk Next: tested both enabled and disabled

Reproduction steps

  1. Enable KernelSU / KernelSU Next
  2. Install AdGuard
  3. Enable AdGuard root mode (iptables-based filtering, no VPN)
  4. Use the device normally (screen on/off, network changes)
  5. After several hours or ~1 day, AdGuard crashes
  6. Logcat shows:
    OutOfMemoryError: pthread_create failed
  7. App cannot be started again until reinstalled

Expected behavior

Long-running root services should not exhaust native threads over time.
Thread stacks should be properly released.


Actual behavior

Native thread stacks accumulate and eventually prevent new threads
from being created, causing permanent failure of the root service.


Similar reports / references

  1. AdGuard root mode causes freezes and crashes with KernelSU / KernelSU Next
    Unexpected freeze and then shutdown on OnePlus Nord 4 when using AdGuard root mode with KernelSU #5797
    (Issue does not reproduce when using Magisk instead of KernelSU)

  2. AdGuard local proxy / root mode issues with KernelSU
    Local Proxy Mode does not work with KernelSU root #4579

  3. KernelSU instability / unexpected reboots on OnePlus devices
    Accidental reboot of Oneplus 13 tiann/KernelSU#2621


Additional notes

  • The same setup using Magisk root does NOT reproduce this issue
  • Disabling root access for the affected app stops the crashes
  • This strongly suggests a KernelSU-specific lifecycle or native thread
    cleanup issue rather than an application bug

Expected Behavior

No response

Actual Behavior

adguard_logs_4.12.80_1801_074930.zip

Screenshots

Screenshot 1

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions