Skip to content
New issue

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

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

Already on GitHub? # to your account

Using Thread-Safe CopyOnWriteArrayList #23

Closed
wants to merge 1 commit into from

Conversation

Howard20181
Copy link
Member

@Howard20181 Howard20181 commented Nov 14, 2022

No description provided.

@Howard20181 Howard20181 force-pushed the Howard20181-patch-1 branch 2 times, most recently from bbb598f to dbe7503 Compare November 14, 2022 05:03
@Howard20181 Howard20181 marked this pull request as ready for review November 14, 2022 05:04
@Howard20181 Howard20181 changed the title Don't logging error level logs at AndroidRuntime Catching error in system procss Nov 14, 2022
@fankes
Copy link
Collaborator

fankes commented Nov 14, 2022

最好把异常捕获封装到跟方法,因为我们不知道会不会有其它地方还会用到它。

@Howard20181 Howard20181 marked this pull request as draft November 14, 2022 05:54
@Howard20181
Copy link
Member Author

正确的是修appErrorsRecords同时读写导致的ConcurrentModificationException
所以这个PR不对的

@Howard20181 Howard20181 marked this pull request as ready for review November 14, 2022 10:58
@Howard20181 Howard20181 changed the title Catching error in system procss Using Thread-Safe CopyOnWriteArrayList Nov 14, 2022
@Howard20181 Howard20181 requested a review from fankes November 14, 2022 11:49
@fankes
Copy link
Collaborator

fankes commented Nov 14, 2022

emm 还是等我后面换方案吧,不太想这样改

@fankes fankes marked this pull request as draft November 14, 2022 14:17
@Howard20181
Copy link
Member Author

Howard20181 commented Nov 14, 2022

现在主要不是广播超出限制的问题
是那个同时读写appErrorsRecords导致Gson在系统服务里面抛出ConcurrentModificationException导致软重启的问题
这个是比较严重的(毕竟排查了几晚才发现是这个模块导致的)

@fankes
Copy link
Collaborator

fankes commented Nov 14, 2022

等我一起修复吧(

@fankes
Copy link
Collaborator

fankes commented Jan 16, 2023

此问题已解决:

  • 解决了数据过大的问题,数据过大将自动分段发送,保证每个数据包大小在 200K 以内就基本上不会发生崩溃

  • 解决了同时读写的问题,使用 CopyOnWriteArrayList

  • 丢掉多线程存储,改用每次即时存储一条数据的方案,直接存储到文件并每次读取缓存

感谢建议,由于我已经更换了存储方案和修改了大量代码,而且这个 PR 修改的内容比较混乱,甚至还在一个不相关功能的 commit 中同时更新了 Gradle 的依赖版本,就不合并了,过几天推送代码后更新版本。

@fankes fankes closed this Jan 16, 2023
@fankes fankes deleted the Howard20181-patch-1 branch January 16, 2023 21:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants