Giter Club home page Giter Club logo

Comments (6)

lcj0304 avatar lcj0304 commented on May 29, 2024

另外,Android12上有崩溃的情况。

Fatal Exception: java.util.ConcurrentModificationException
       at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:970)
       at java.util.LinkedList$ListItr.next(LinkedList.java:892)
       at android.app.QueuedWork.processPendingWork(QueuedWork.java:264)
       at android.app.QueuedWork.access$000(QueuedWork.java:51)
       at android.app.QueuedWork$QueuedWorkHandler.handleMessage(QueuedWork.java:285)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.os.HandlerThread.run(HandlerThread.java:67)

from spwaitkiller.

Knight-ZXW avatar Knight-ZXW commented on May 29, 2024

// 在work.size之前,如果其他线程又有数据向添加sWork ,Android12 work.size()重新设置代理,
是不是添加到的sWork数据会丢失?work.size()可不在sLock下执行。

看了下代码, 此时 新的任务是添加到新的 sWork中,和被代理 size()函数的不是同一个对象。

Fatal Exception: java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:970)
at java.util.LinkedList$ListItr.next(LinkedList.java:892)
at android.app.QueuedWork.processPendingWork(QueuedWork.java:264)
at android.app.QueuedWork.access$000(QueuedWork.java:51)
at android.app.QueuedWork$QueuedWorkHandler.handleMessage(QueuedWork.java:285)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.os.HandlerThread.run(HandlerThread.java:67)

这个异常对应的264行,理论上Android 12 此时 size()函数总是返回0, 应该不会进入 下面的 迭代器执行, 你这个崩溃出现概率高吗,是在线上环境收集的异常吗?
image

from spwaitkiller.

Knight-ZXW avatar Knight-ZXW commented on May 29, 2024

// 在work.size之前,如果其他线程又有数据向添加sWork ,Android12 work.size()重新设置代理,
是不是添加到的sWork数据会丢失?work.size()可不在sLock下执行。

看了下代码, 此时 新的任务是添加到新的 sWork中,和被代理 size()函数的不是同一个对象。

Fatal Exception: java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:970)
at java.util.LinkedList$ListItr.next(LinkedList.java:892)
at android.app.QueuedWork.processPendingWork(QueuedWork.java:264)
at android.app.QueuedWork.access$000(QueuedWork.java:51)
at android.app.QueuedWork$QueuedWorkHandler.handleMessage(QueuedWork.java:285)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.os.HandlerThread.run(HandlerThread.java:67)

这个异常对应的264行,理论上Android 12 此时 size()函数总是返回0, 应该不会进入 下面的 迭代器执行, 你这个崩溃出现概率高吗,是在线上环境收集的异常吗?
image

from spwaitkiller.

lcj0304 avatar lcj0304 commented on May 29, 2024

我是有一个疑问和一个崩溃,崩溃和疑问没有关系。

先回复崩溃:
崩溃是线上环境,崩溃概率并不高。偶尔会有,我也看了代码,按道理不应该进入下面的循环。我本地无法重现。会不会出现某些字段代码失败导致的,我的崩溃信息也就上面给的这些。

关于疑问:

” 此时 新的任务是添加到新的 sWork中,和被代理 size()函数的不是同一个对象“
任务是添加到新的sWork中,但下面 work.size()时候,会重新使用代理对象去设置那个sWork字段,那此时加入新 的sWork的任务是不是就没机会处理了,整个对象都被替换掉了?

from spwaitkiller.

Knight-ZXW avatar Knight-ZXW commented on May 29, 2024

好像确实是有问题,Android 12重新设置 sWork字段的时候,应该重新代理下 目前的 sWork列表, 我验证一下这个问题

from spwaitkiller.

Knight-ZXW avatar Knight-ZXW commented on May 29, 2024

#8

@lcj0304 review下,这个BUG 和你的疑问 可能是同一个问题导致的,在Android12 每次调用 .size()函数后,此时sWork指向了一个新的对象, 应该重新 获取sWork的引用对象,重新进行代理

from spwaitkiller.

Related Issues (4)

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.