Skip to content

Error (native) com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-732891536 #720

Closed

Description

@NathanaelA

This error comes up infrequently in a TNS app.

Please, provide the details below:

Did you verify this is a real problem by searching [Stack Overflow]

Several closed issues like this; none remain open.

Tell us about the problem

I am getting this via a crash recorder:

Error: The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception. Error: The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception.\n at Error (native) com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=-732891536"

Please provide the following version numbers that your issue occurs with:

Android Runtime: 2.4.1
Core Modules: 2.4.4
No Snapshot (Snapshot was disabled do to issues)
Release Mode

Please tell us how to recreate the issue in as much detail as possible.

I am unable to duplicate it in house; but I see one of these error messages in my log at least twice a week for the last couple months.

If you have some way to determine what that object id is at crash time; that would be great to be able to see what is being cleaned up and removed improperly.

Activity

  1. petekanev commented on Mar 7, 2017

    @petekanev
    Contributor

    Related to #466

  2. NathanaelA commented on Mar 7, 2017

    @NathanaelA
    Author
  3. Plamen5kov commented on Mar 7, 2017

    @Plamen5kov
    Contributor

    @NathanaelA truth is there's no easy way of tracking this issue down:

    • we can't figure out how to reproduce it and that's normal because,
    • it's connected to the way we do garbage collection
      It's a very unpleasant issue, I know, but until we find a way to reproduce it, we can only do blind fixes, and as we all know, that wont be as effective as debugging and figuring out what's wrong.

    Any idea how we can track this down;

    Well __enableVerboseLogging() and send us the logcat of the crash, this way, we'll be able to see, at least, the id of the problematic object and it would be some kind of a start.

  4. NathanaelA commented on Mar 7, 2017

    @NathanaelA
    Author
  5. Plamen5kov commented on Mar 7, 2017

    @Plamen5kov
    Contributor

    It's a great idea, we can do a logcat dump to file when an application crash, which can later be handled as you said.

  6. nirsalon commented on Mar 9, 2017

    @nirsalon

    Just happened here on release mode as well:

    tns-android: 2.4.1
    tns-core-modules: 2.4.4
    API Level 23
    Phone: XT1580

    Exception com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=1057 com.tns.Runtime.getJavaObjectByID (Runtime.java:971) com.tns.Runtime.callJSMethodNative (Runtime.java) com.tns.Runtime.dispatchCallJSMethodNative (Runtime.java:1197) com.tns.Runtime.callJSMethodImpl (Runtime.java:1061) com.tns.Runtime.callJSMethod (Runtime.java:1047) com.tns.Runtime.callJSMethod (Runtime.java:1028) com.tns.Runtime.callJSMethod (Runtime.java:1018) com.tns.gen.android.view.View_OnTouchListener.onTouch (android.view.View$OnTouchListener.java) android.view.View.dispatchTouchEvent (View.java:9293) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2549) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2240) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2555) android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2254) com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:2403) com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1737) android.app.Activity.dispatchTouchEvent (Activity.java:2769) com.appsee.f.dispatchTouchEvent (e:625) com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:2364) android.view.View.dispatchPointerEvent (View.java:9517) android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:4242) android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:4108) android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3654) android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:3707) android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:3673) android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:3799) android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:3681) android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:3856) android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3654) android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:3707) android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:3673) android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:3681) android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3654) android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:5969) android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:5908) android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:5869) android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:6072) android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:192) android.os.MessageQueue.nativePollOnce (MessageQueue.java) android.os.MessageQueue.next (MessageQueue.java:323) android.os.Looper.loop (Looper.java:135) android.app.ActivityThread.main (ActivityThread.java:5443) java.lang.reflect.Method.invoke (Method.java)

  7. NathanaelA commented on Mar 17, 2017

    @NathanaelA
    Author
  8. Plamen5kov commented on Mar 20, 2017

    @Plamen5kov
    Contributor

    @NathanaelA we'll consider it, thank you for your feedback.

  9. SBD580 commented on Mar 23, 2017

    @SBD580

    +1 same thing here

  10. Plamen5kov commented on Mar 23, 2017

    @Plamen5kov
    Contributor

    @SBD580 do you by any chance have steps to reproduce?

  11. SBD580 commented on Mar 23, 2017

    @SBD580

    I'm afraid not

  12. NathanaelA commented on Mar 26, 2017

    @NathanaelA
    Author
  13. Plamen5kov commented on Mar 27, 2017

    @Plamen5kov
    Contributor

    @NathanaelA, thank you, that's useful information to me.

  14. added a commit that references this issue on Apr 24, 2017
    350090c
  15. petekanev commented on Apr 24, 2017

    @petekanev
    Contributor

    @NathanaelA @SBD580 PR Merged. The fix will be available in release 3.0.0

  16. added this to the milestone on Apr 24, 2017
  17. jeffswitzer commented on Apr 23, 2018

    @jeffswitzer

    Recently opened up an app for coworkers to test and one of them reported the following runtime error on android. This is with tns --verision = 4.0.0-2018-03-30-11339. Also for this release I have the following settings, I was curious if markingMode has something to do with this - sometime ago I had set it to none to greatly app boost performance.

    "android": {
            "v8Flags": "--expose_gc",
            "gcThrottleTime": 9995000,
            "memoryCheckInterval": 0,
            "freeMemoryRatio": 0.0,
            "markingMode": "none"
        }
    
    An uncaught Exception occurred on "main" thread.
    com.tns.NativeScriptException: No weak reference found. Attempt to use cleared object reference id=26391
    	at com.tns.Runtime.getJavaObjectByID(Runtime.java:892)
    	at com.tns.Runtime.callJSMethodNative(Native Method)
    	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
    	at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
    	at com.tns.Runtime.callJSMethod(Runtime.java:957)
    	at com.tns.Runtime.callJSMethod(Runtime.java:941)
    	at com.tns.Runtime.callJSMethod(Runtime.java:933)
    	at com.tns.gen.android.app.DialogFragment_frnal_ts_helpers_l58_c38__DialogFragmentImpl.onCreateView(DialogFragment_frnal_ts_helpers_l58_c38__DialogFragmentImpl.java:20)
    	at android.app.Fragment.performCreateView(Fragment.java:2353)
    	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
    	at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
    	at android.app.BackStackRecord.run(BackStackRecord.java:816)
    	at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1580)
    	at android.app.FragmentManagerImpl$1.run(FragmentManager.java:483)
    	at android.os.Handler.handleCallback(Handler.java:751)
    	at android.os.Handler.dispatchMessage(Handler.java:95)
    	at android.os.Looper.loop(Looper.java:154)
    	at android.app.ActivityThread.main(ActivityThread.java:6196)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions