Unknown bug "Thread starting during runtime shutdown"
Asked Answered
T

3

16

I'm using Fabric to report crash for my app. I have received those report for a very long time and the number of crashes keep increasing.

Fatal Exception: java.lang.InternalError: Thread starting during runtime shutdown
   at java.lang.Thread.nativeCreate(Thread.java)
   at java.lang.Thread.start(Thread.java:730)
   at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:941)
   at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1009)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1151)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
   at java.lang.Thread.run(Thread.java:761)

There is also a list of 62 Threads attached with this report, I can post it here if you guys want.

I have no idea which part of code cause this or how to replicate the bug. So I hope you can guide me to find and solve this case.

Tansey answered 9/8, 2017 at 7:24 Comment(0)
J
3

I had the same issue...

I have updated the fabric plugin, then updated the twitter sdk..

then clean my project and rebuild the apk..my error has been gone.

some time this error occurred while some ANR occurs.

Jeep answered 9/8, 2017 at 9:57 Comment(4)
Thank you for helping me. I will do it your way for the next release and see if my error will also be solved.Tansey
@MohammadHamoud sadly not and I don't know how to solve it. Maybe I need to review the whole source code but I don't have time for it at the moment.Tansey
Sorry, Fabric is updated to the latest, but still getting the same errorSalem
@Jeep Can you share the version number it worked for you ?Sort
L
6

The current thread is started too late, that is, when you receive an uncaught exception in the UncaughtExceptionHandler, a child thread is started to upload the error log. HttpClient is created when the error log is uploaded, but ThreadSafeClientConnManager was set to manage the connection when created.

By viewing the source code of ThreadSafeClientConnManager, it was found that ThreadSafeClientConnManager also opened child threads, which caused the problem of opening child threads in child threads, which would cause uncaughtException () in the thread after execution was completed Only when the thread is started, java.lang.InternalError: Thread starting during runtime shutdown will be thrown.

The solution to this problem is: Create HttpClient in advance, because HttpClient creation will also start the thread, avoid creation in uncaughtException (), thereby avoiding the problem of starting the thread in the thread.

Alternative solution: Remove UncaughtExceptionHandler from your code in case it tried to create a thread.

Lam answered 18/3, 2020 at 11:6 Comment(0)
J
3

I had the same issue...

I have updated the fabric plugin, then updated the twitter sdk..

then clean my project and rebuild the apk..my error has been gone.

some time this error occurred while some ANR occurs.

Jeep answered 9/8, 2017 at 9:57 Comment(4)
Thank you for helping me. I will do it your way for the next release and see if my error will also be solved.Tansey
@MohammadHamoud sadly not and I don't know how to solve it. Maybe I need to review the whole source code but I don't have time for it at the moment.Tansey
Sorry, Fabric is updated to the latest, but still getting the same errorSalem
@Jeep Can you share the version number it worked for you ?Sort
M
0

I had the same problem and the reason was a line in one of my XML files. for me it was

    android:background="?android:attr/selectable"

that attribute was not defined.

Motto answered 23/3, 2022 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.