Open jieliangma opened 5 years ago
协程的block是有重入吗?理论上正常使用不应该进入这里
I am getting these same crashes in crash logs from the app I recently added coswift to.
Crashed: com.apple.root.default-qos
SIGABRT ABORT 0x0000000183a0fd88
Crashed: com.apple.root.default-qos
0 libsystem_kernel.dylib 0x183a0fd88 __pthread_kill + 8
1 libsystem_pthread.dylib 0x1839281e8 pthread_kill$VARIANT$mp + 136
2 libsystem_c.dylib 0x18387b934 abort + 100
3 libsystem_c.dylib 0x18387ad54 err + 286
4 cocore 0x103d749b4 coroutine_resume_im + 348
5 cocore 0x103d74790 coroutine_scheduler_main + 76
6 cocore 0x103d74ae8 coroutine_main + 32
The crash is on the assert at the bottom of the function, indicating the coroutine status is neither ready nor suspended.
My usage is fairly straightforward, launching a single coroutine with several async functions using a channel to suspend the coroutine while performing some database I/O.
I will swap the channels out to use promises instead and note if the crashes continue afterwards.
After changing the Chan
s to Promise
s, the crash continues. So this isn't specifically caused by one or the other.
Could you provide the demo code?
This seems to be resolved with a change I made to ensure canceling an active coroutine before dismissing a view controller.
堆栈
推测崩溃的代码行:coroutine.m:237