Skip to content

Fatal Exception: java.lang.ClassCastException #1032

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

Closed
michal-chojnacki opened this issue Mar 8, 2019 · 4 comments
Closed

Fatal Exception: java.lang.ClassCastException #1032

michal-chojnacki opened this issue Mar 8, 2019 · 4 comments

Comments

@michal-chojnacki
Copy link

One of the devices I have a lot of crashes like that:

Fatal Exception: java.lang.ClassCastException
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.targetCheck(AtomicReferenceFieldUpdater.java:244)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.get(AtomicReferenceFieldUpdater.java:293)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.getAndSet(AtomicReferenceFieldUpdater.java:151)
       at kotlinx.coroutines.scheduling.WorkQueue.poll(WorkQueue.kt:65)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.findTaskWithCpuPermit(CoroutineScheduler.kt:969)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.findTask$kotlinx_coroutines_core(CoroutineScheduler.kt:944)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:725)

What can be the reason and how can I avoid such situations?
Device Rockchip RK3368-Box
Android 6.0.1
Kotlin version 1.3.21
Coroutines version 1.1.1

@qwwdfsad qwwdfsad reopened this Mar 12, 2019
@qwwdfsad
Copy link
Member

It is very suspicious. It looks like #490, but it is not.
Can you reproduce this problem locally or using an emulator?

@michal-chojnacki
Copy link
Author

I wasn't able to reproduce it. However problem disappeared. I found at the code that Job wasn't canceled for one ViewModel during onCleared. Maybe this was the reason of this issue.

@qwwdfsad
Copy link
Member

Ok, then I am closing this issue.
Feel free to reopen it if you will have this issue again

@xudshen
Copy link

xudshen commented Apr 1, 2019

I got the same problem here, but I haven't reproduced it yet.

Fatal Exception: java.lang.ClassCastException
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.throwAccessCheckException(AtomicReferenceFieldUpdater.java:388)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.accessCheck(AtomicReferenceFieldUpdater.java:379)
       at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.getAndSet(AtomicReferenceFieldUpdater.java:442)
       at kotlinx.coroutines.c.o.b(WorkQueue.kt:65)
       at kotlinx.coroutines.c.a$b.p(CoroutineScheduler.kt:950)
       at kotlinx.coroutines.c.a$b.k(CoroutineScheduler.kt:928)

And this crash happens all among the devices.
Screen Shot 2019-04-01 at 16 24 24

Kotlin version 1.3.0
Coroutines version 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants