Coder Social home page Coder Social logo

Random NPE about curve-fit HOT 12 CLOSED

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024
Random NPE

from curve-fit.

Comments (12)

ryust avatar ryust commented on May 26, 2024 1

I think I have it working now. I made sure the unregister was done after the map closed and that may have fixed the issue I had with curves not showing. Thanks for the fix and nice library!

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

Periodically, I'll get a NullPointerException when closing a map with a curve and then reopening it to show the curve again. I haven't isolated a pattern yet. Here is the stack trace:

java.lang.NullPointerException: Attempt to invoke interface method 'void com.makesense.labs.curvefit.interfaces.UiThreadCallback.publishToUiThread(android.os.Message)' on a null object reference
at com.makesense.labs.curvefit.impl.WorkerHandlerThread$1.handleMessage(WorkerHandlerThread.java:83)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)

I'm trying to reproduce the issue. In WorkerHandlerThread class, I have used a WeakReference object to hold a callback reference to the CurveManager class. Therefore, it is eligible for garbage collection. This could be causing some issue, but I'm still not sure. If you could provide me little more details like, steps to reproduce the issue or sending some dummy apk would be helpful to understand the problem better.

from curve-fit.

ryust avatar ryust commented on May 26, 2024

I'll look into it some more, but so far no pattern other than opening/closing map with curves. I set the CurveManager to null on map close so something with the weak reference could be the issue. I'm trying to delay showing the curves after map loaded to see if that fixes it.

from curve-fit.

ryust avatar ryust commented on May 26, 2024

I'm still getting periodic bug reports with this NPE. Any possibility of wrapping the code with a try/catch so the error doesn't cause a crash?

It's so random I can't offer any more information and the app is so large there is no way to provide you with a test case.

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

Hi,
I am unable to reproduce the issue of what you are facing right now. By this weekend, I'll release a new beta version of the library which will be compatible with Maps 3.0 beta. Please wait for that release.

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

Sorry for the delay.

This bug has been fixed in new 2.0.0 beta version. Please try using that.

from curve-fit.

ryust avatar ryust commented on May 26, 2024

I can't implement the Android Maps beta yet... any way you can add the fix to the current 1.1.0 release for those of us that need to run without the beta?

from curve-fit.

ryust avatar ryust commented on May 26, 2024

If you can tell me what was changed, I'll try to fix it myself on the non-beta version... it's frustrating to have NPEs in a production app for a nice library like this.

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

Sorry for late reply. I was on leave due to medical emergency. I will add the fix to the non beta version soon.

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

The patch is applied. Curve-Fit 1.1.1 is available now.

from curve-fit.

ryust avatar ryust commented on May 26, 2024

Well, 1.1.1 is actually worse. Not getting NPE, but also 95% of the time the curves do not render on the map. When it rarely renders, then multiple close/open of the map doesn't seem to ever show curves again until the app is restarted.

Is CurveManager.unregister necessary? I haven't been using it.

from curve-fit.

sarweshkumar47 avatar sarweshkumar47 commented on May 26, 2024

Calling unregister method at the end is necessary. Otherwise, memory leaks will occur for sure. Also, the old GoogleMap object will not be garbage collected and the Handler uses this reference (old) to draw the PolyLine (which will not have any effect).

from curve-fit.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.