Skip to content

ExceptionsManagerModule.reportException #53672

Description

@Neelu1112

Description

After upgrading to react-native 0.79 facing below crash on firebase.
Occurence is very high for this.

Fatal Exception: com.facebook.react.common.JavascriptException: Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops., js engine: hermes, stack:
getRootForUpdatedFiber@1:170970
enqueueUpdate@1:173413
enqueueSetState@1:234482
anonymous@1:114786
anonymous@1:2433715
measure@1:431645
anonymous@1:2433646

   at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.kt:52)
   at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
   at android.os.Handler.handleCallback(Handler.java:1001)
   at android.os.Handler.dispatchMessage(Handler.java:105)
   at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.kt:20)
   at android.os.Looper.loopOnce(Looper.java:268)
   at android.os.Looper.loop(Looper.java:384)
   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$Companion.startNewBackgroundThread$lambda$1(MessageQueueThreadImpl.kt:175)
   at java.lang.Thread.run(Thread.java:1119)

CleanupReference:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:405)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:207)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:228)
at WV.Gf.run(chromium-TrichromeWebViewGoogle6432.aab-stable-725815833:3)

GoogleApiHandler:
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:353)
at android.os.Looper.loopOnce(Looper.java:209)
at android.os.Looper.loop(Looper.java:384)
at android.os.HandlerThread.run(HandlerThread.java:103)

GL-Map:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:405)
at java.lang.Object.wait(Object.java:543)
at m140.fgl.run(:com.google.android.gms.policy_maps_core_dynamite@252725204@252725201025.791442750.791442750:961)

Firebase Blocking Thread #23:
at jdk.internal.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410)
at java.util.concurrent.LinkedTransferQueue$DualNode.await(LinkedTransferQueue.java:452)
at java.util.concurrent.SynchronousQueue$Transferer.xferLifo(SynchronousQueue.java:194)
at java.util.concurrent.SynchronousQueue.xfer(SynchronousQueue.java:233)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:336)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1081)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:47)
at java.lang.Thread.run(Thread.java:1119)

Firebase-Messaging-Task:
at jdk.internal.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519)
at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805)
at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.5.0:2)
at java.lang.Thread.run(Thread.java:1119)

PlatformServiceBridgeHandlerThread:
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:353)
at android.os.Looper.loopOnce(Looper.java:209)
at android.os.Looper.loop(Looper.java:384)
at android.os.HandlerThread.run(HandlerThread.java:103)

DefaultDispatcher-worker-3:
at jdk.internal.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.park(CoroutineScheduler.kt:858)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.tryPark(CoroutineScheduler.kt:806)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:754)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)

CameraAvailabilityObserver_ObservationThread:
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:353)
at android.os.Looper.loopOnce(Looper.java:209)
at android.os.Looper.loop(Looper.java:384)
at android.os.HandlerThread.run(HandlerThread.java:103)

android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: "com.google.gms.google-services"
project.ext.envConfigFiles = [
    dev: ".env.dev",
    qa: ".env.qa",
    stage: ".env.stage",
    prod: ".env.prod"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"


/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
   //   The root of your project, i.e. where "package.json" lives. Default is '../..'
    // root = file("../../")
    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native
    // reactNativeDir = file("../../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
    // codegenDir = file("../../node_modules/@react-native/codegen")
    //   The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
    // cliFile = file("../../node_modules/react-native/cli.js")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]
    //
    //   The command to run when bundling. By default is 'bundle'
    // bundleCommand = "ram-bundle"
    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
   // hermesCommand = "./node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]

    /* Autolinking */
    autolinkLibrariesWithApp()
}


/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = true

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US. Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'


def versCode
def versName

android {
    ndkVersion rootProject.ext.ndkVersion

    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace "com.familydollar.consumer"
    defaultConfig {
        applicationId "com.familydollar"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName '1.0'
        missingDimensionStrategy 'react-native-ssl-pinning', 'general'
    }

    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            debuggable false
            minifyEnabled enableProguardInReleaseBuilds
            shrinkResources enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "environment"
    productFlavors {
        dev {
            dimension "environment"
            applicationIdSuffix ".consumer.dev"
            resValue "string", "build_config_package", "com.familydollar.consumer"
            resValue "string", "CodePushDeploymentKey", '""'
        }
        qa {
            // Assigns this product flavor to the "version" flavor dimension.
            // If you are using only one dimension, this property is optional,
            // and the plugin automatically assigns all the module's flavors to
            // that dimension.
            dimension "environment"
            applicationIdSuffix ".consumer.qa"
            resValue "string", "build_config_package", "com.familydollar.consumer"
            versionCode versCode as Integer
            versionName versName
        }
        stage {
            dimension "environment"
            applicationIdSuffix ".consumer.stage"
            resValue "string", "build_config_package", "com.familydollar.consumer"
            versionCode versCode as Integer
            versionName versName
        }
        prod {
            dimension "environment"
            resValue "string", "build_config_package", "com.familydollar.consumer"
            versionCode versCode as Integer
            versionName versName
        }
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }

  implementation 'com.google.android.gms:play-services-base:18.2.0'
  implementation 'com.google.android.gms:play-services-location:21.0.1'
  implementation 'com.google.android.gms:play-services-maps:18.2.0'
  implementation 'org.jetbrains:annotations:16.0.2'
  implementation 'com.google.android.gms:play-services-appset:16.0.0'
  implementation platform('com.google.firebase:firebase-bom:32.7.0')
  implementation 'com.google.firebase:firebase-config:21.6.0'
  implementation 'com.google.firebase:firebase-analytics'
  implementation 'com.squareup.okhttp3:okhttp:4.12.0'
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.ext.kotlinVersion"
  implementation 'com.google.firebase:firebase-perf:20.5.2'
}

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'AntDesign.ttf', 'Entypo.ttf', 'EvilIcons.ttf', 'Feather.ttf', 'FontAwesome.ttf', 'FontAwesome5_Brands.ttf', 'FontAwesome5_Regular.ttf', 'FontAwesome5_Solid.ttf', 'Foundation.ttf', 'SimpleLineIcons.ttf', 'Octicons.ttf', 'Zocial.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

Steps to reproduce

Issue is on prod environment specifically on android not on ios

React Native Version

0.79.2

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.4
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 56.46 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.12.0
    path: ~/.nvm/versions/node/v22.12.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.12.0/bin/yarn
  npm:
    version: 11.3.0
    path: ~/.nvm/versions/node/v22.12.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/neemanwa/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.1 AI-211.7628.21.2111.8193401
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/neemanwa/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Fatal Exception: com.facebook.react.common.JavascriptException: Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops., js engine: hermes, stack:
getRootForUpdatedFiber@1:170970
enqueueUpdate@1:173413
enqueueSetState@1:234482
anonymous@1:114786
anonymous@1:2433715
measure@1:431645
anonymous@1:2433646

       at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.kt:52)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:1001)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.kt:20)
       at android.os.Looper.loopOnce(Looper.java:268)
       at android.os.Looper.loop(Looper.java:384)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$Companion.startNewBackgroundThread$lambda$1(MessageQueueThreadImpl.kt:175)
       at java.lang.Thread.run(Thread.java:1119)

CleanupReference:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:405)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:207)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:228)
       at WV.Gf.run(chromium-TrichromeWebViewGoogle6432.aab-stable-725815833:3)

GoogleApiHandler:
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:353)
       at android.os.Looper.loopOnce(Looper.java:209)
       at android.os.Looper.loop(Looper.java:384)
       at android.os.HandlerThread.run(HandlerThread.java:103)

GL-Map:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:405)
       at java.lang.Object.wait(Object.java:543)
       at m140.fgl.run(:com.google.android.gms.policy_maps_core_dynamite@252725204@252725201025.791442750.791442750:961)

Firebase Blocking Thread #23:
       at jdk.internal.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410)
       at java.util.concurrent.LinkedTransferQueue$DualNode.await(LinkedTransferQueue.java:452)
       at java.util.concurrent.SynchronousQueue$Transferer.xferLifo(SynchronousQueue.java:194)
       at java.util.concurrent.SynchronousQueue.xfer(SynchronousQueue.java:233)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:336)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1081)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:47)
       at java.lang.Thread.run(Thread.java:1119)

MANDATORY Reproducer

none

Screenshots and Videos

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions