Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException crash without any reference to my code #325

Closed
lawloretienne opened this issue Nov 12, 2015 · 4 comments
Closed

Comments

@lawloretienne
Copy link

I am using the latest snapshot release

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-SNAPSHOT'

and getting the following exception thrown, but I dont see in this stack trace any reference to my code

In com.biggu.shopsavvy:9.4.2:80230.

  • FAILURE:
    java.lang.IllegalArgumentException: Field offset does not exists
    at com.squareup.leakcanary.HahaHelper.fieldValue(HahaHelper.java:143)
    at com.squareup.leakcanary.HahaHelper.asString(HahaHelper.java:81)
    at com.squareup.leakcanary.HeapAnalyzer.findLeakingReference(HeapAnalyzer.java:97)
    at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:79)
    at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:59)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.os.HandlerThread.run(HandlerThread.java:61)
  • Reference Key: 775dfa64-840c-474a-9c34-bd7186b6e6e6
  • Device: LGE google Nexus 5X bullhead
  • Android Version: 6.0 API: 23 LeakCanary: 1.4-SNAPSHOT 6c0bee2
  • Durations: watch=5017ms, gc=184ms, heap dump=9389ms, analysis=10584ms
  • Excluded Refs:
    | Field: android.view.textservice.SpellCheckerSession$1.this$0
    | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
    | Thread:FinalizerWatchdogDaemon (always)
    | Thread:main (always)
    | Thread:LeakCanary-Heap-Dump (always)
    | Class:java.lang.ref.WeakReference (always)
    | Class:java.lang.ref.SoftReference (always)
    | Class:java.lang.ref.PhantomReference (always)
    | Class:java.lang.ref.Finalizer (always)
    | Class:java.lang.ref.FinalizerReference (always)
@eneim
Copy link

eneim commented Nov 13, 2015

I got the same one. The cause maybe this line

keyCandidate.equals(key)

Since findLeakingReference(String key, Snapshot snapshot) accepts Nonnull key parameter, it's better to have the following fix I suppose.

keyCandidate.equals(key) --> key.equals(keyCandidate)

@lawloretienne
Copy link
Author

So how can you resolve this issue @eneim ?

@eneim
Copy link

eneim commented Nov 20, 2015

@lawloretienne So sorry, I didn't mean I solved the problem. I'm working on a production which use this library to catch the leak, and face the same issues. But I didn't have enough time to investigate more or clone the project to local to modify it. But you could do it and try the fix I suggested.

@jrodbx
Copy link
Collaborator

jrodbx commented Jan 2, 2016

Duplicate of #267

@jrodbx jrodbx closed this as completed Jan 2, 2016
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

No branches or pull requests

3 participants