Skip to content

ANR (Application Not Responding) - Main Thread Blocking During Talsec Initialization #180

@Hritik602

Description

@Hritik602

⚠️ Important: This issue cannot be reliably reproduced manually during development/testing. It appears sporadically in production and is reported via Google Play Console's ANR statistics.

Description

Based on the stacktrace analysis, it appears that the Talsec.start() method may be performing synchronous file I/O operations on the calling thread. While I cannot confirm with absolute certainty, the evidence strongly suggests this could be causing ANR (Application Not Responding) issues when called from the main/UI thread in production environments.

Stacktrace

"main" tid=1 Native
  #00  pc 0x000000000005775c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 0x0000000000201230  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks+136)
  #02  pc 0x0000000000671ddc  /apex/com.android.art/lib64/libart.so (art::JNI<false>::ReleaseByteArrayElements+1936)
  #03  pc 0x000000000002ce94  /apex/com.android.art/lib64/libjavacore.so (Linux_readBytes+348)
  at libcore.io.Linux.readBytes (Native method)
  at libcore.io.Linux.read (Linux.java:229)
  at libcore.io.ForwardingOs.read (ForwardingOs.java:618)
  at libcore.io.BlockGuardOs.read (BlockGuardOs.java:325)
  at libcore.io.ForwardingOs.read (ForwardingOs.java:618)
  at libcore.io.IoBridge.read (IoBridge.java:604)
  at java.io.FileInputStream.read (FileInputStream.java:353)
  at java.io.BufferedInputStream.read1 (BufferedInputStream.java:277)
  at java.io.BufferedInputStream.read (BufferedInputStream.java:338)
  at sun.nio.cs.StreamDecoder.readBytes (StreamDecoder.java:291)
  at sun.nio.cs.StreamDecoder.implRead (StreamDecoder.java:355)
  at sun.nio.cs.StreamDecoder.read (StreamDecoder.java:181)
  at java.io.Reader.read (Reader.java:189)
  at java.io.InputStreamReader.read (InputStreamReader.java:157)
  at java.util.Scanner.readInput (Scanner.java:892)
  at java.util.Scanner.next (Scanner.java:1495)
  at com.aheaditec.talsec.security.s1.a (SourceFile:1)
  at com.aheaditec.talsec.security.s1.c (SourceFile:1)
  at com.aheaditec.talsec.security.g0.a (SourceFile:23)
  at com.aheaditec.talsec.security.g0.f (SourceFile:1)
  at com.aheaditec.talsec.security.g0.<init> (SourceFile:4)
  at com.aheaditec.talsec.security.n1.<init> (SourceFile:1)
  at com.aheaditec.talsec.security.m1.<init> (SourceFile:7)
  at com.aheaditec.talsec.security.m1.a (SourceFile:3)
  at com.aheaditec.talsec_security.security.api.Talsec.start (unavailable:41)
  at com.aheaditec.freerasp.handlers.TalsecThreatHandler.start$freerasp_release (TalsecThreatHandler.kt:28)
  at com.aheaditec.freerasp.handlers.MethodCallHandler.start (MethodCallHandler.kt:140)
  at com.aheaditec.freerasp.handlers.MethodCallHandler.onMethodCall (MethodCallHandler.kt:119)
  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage (MethodChannel.java:267)
  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler (DartMessenger.java:292)
  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger (DartMessenger.java:319)
  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run (D8$$SyntheticClass)
  at android.os.Handler.handleCallback (Handler.java:996)
  at android.os.Handler.dispatchMessage (Handler.java:110)
  at android.os.Looper.loopOnce (Looper.java:210)
  at android.os.Looper.loop (Looper.java:302)
  at android.app.ActivityThread.main (ActivityThread.java:9675)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:601)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1062)
flutter doctor --verbose
[✓] Flutter (Channel stable, 3.35.0, on macOS 15.6 24G84 darwin-arm64, locale en-NP) [327ms]
    • Flutter version 3.35.0 on channel stable at /Users/hritikkarn/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b896255557 (8 weeks ago), 2025-08-13 17:14:08 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0-rc3) [1,278ms]
    • Android SDK at /Users/hritikkarn/Library/Android/sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36, build-tools 36.0.0-rc3
    • ANDROID_HOME = /Users/hritikkarn/Library/Android/sdk
    • Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Homebrew (build 17.0.15+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [889ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [7ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] Connected device (1 available) [6.5s]
    • M2101K7BG (mobile) • EURGKF6XU8RSKBK7 • android-arm64  • Android 13 (API 33)

[✓] Network resources [466ms]
    • All expected network resources are available.

• No issues found!

freerasp: ^7.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions