Skip to content

ANR: Use LineChart and run for a long time #5523

Description

@prentysst

Run for about 10 hours or more, click on the screen and ANR appears.

**Device

Android 11

My mapping.txt fragment:

com.github.mikephil.charting.utils.Transformer -> s5.g:
......
com.github.mikephil.charting.jobs.MoveViewJob -> n5.a:
com.github.mikephil.charting.utils.ObjectPool pool -> l
1:2:void ():18:19 ->
1:1:void (com.github.mikephil.charting.utils.ViewPortHandler,float,float,com.github.mikephil.charting.utils.Transformer,android.view.View):37:37 ->
1:1:com.github.mikephil.charting.utils.ObjectPool$Poolable instantiate():54:54 -> a
1:6:com.github.mikephil.charting.jobs.MoveViewJob getInstance(com.github.mikephil.charting.utils.ViewPortHandler,float,float,com.github.mikephil.charting.utils.Transformer,android.view.View):23:28 -> b
1:1:void recycleInstance(com.github.mikephil.charting.jobs.MoveViewJob):33:33 -> c
1:2:void run():43:44 -> run
3:4:void run():46:47 -> run
5:5:void run():49:49 -> run
com.github.mikephil.charting.jobs.ViewPortJob -> n5.b:
com.github.mikephil.charting.utils.Transformer mTrans -> j
android.view.View view -> k
float yValue -> i
float xValue -> h
float[] pts -> f

Finally locate the problem point:

at s5.g.k(SourceFile:1)
at n5.a.run(SourceFile:3)

"main" prio=5 tid=1 Runnable
| group="main" sCount=0 dsCount=0 flags=0 obj=0x721317d8 self=0xb4000075d9d92380
| sysTid=1706 nice=-10 cgrp=default sched=0/0 handle=0x770078b4f8
| state=R schedstat=( 2481860227694 655260783667 2849306 ) utm=217888 stm=30297 core=3 HZ=100
| stack=0x7ff658b000-0x7ff658d000 stackSize=8192KB
| held mutexes= "mutator lock"(shared held)
native: #00 pc 0000000000496638 /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
native: #1 pc 00000000005a01d8 /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits >&, bool, BacktraceMap*, bool) const+372)
native: #2 pc 00000000005bce18 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+892)
native: #3 pc 00000000005a1094 /apex/com.android.art/lib64/libart.so (art::Thread::RunCheckpointFunction()+168)
native: #4 pc 000000000065c8bc /apex/com.android.art/lib64/libart.so (art::JniMethodFastEnd(unsigned int, art::Thread*)+132)
at android.graphics.Matrix.nMapPoints(Native method)
at android.graphics.Matrix.mapPoints(Matrix.java:635)
at android.graphics.Matrix.mapPoints(Matrix.java:698)
at s5.g.k(SourceFile:1)
at n5.a.run(SourceFile:3)
at android.os.Handler.handleCallback(Handler.java:956)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at c.c.a.a$a.run(SourceFile:1)
at android.os.Handler.handleCallback(Handler.java:956)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7664)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Source code:

public class MoveViewJob extends ViewPortJob {

............
@OverRide
public void run() {

    pts[0] = xValue;
    pts[1] = yValue;

    mTrans.pointValuesToPixel(pts);
    mViewPortHandler.centerViewPort(pts, view);

    this.recycleInstance(this);
}

@Override
protected ObjectPool.Poolable instantiate() {
    return new MoveViewJob(mViewPortHandler, xValue, yValue, mTrans, view);
}

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions