Skip to content
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

调用函数 void coroutine_resume_im(coroutine_t *co) 时,没有保证 coroutine_t 的状态为 Ready 或 Suspend #84

Open
jieliangma opened this issue May 29, 2019 · 5 comments

Comments

@jieliangma
Copy link
Contributor

堆栈
image

推测崩溃的代码行:coroutine.m:237

@jieliangma jieliangma changed the title 调用函数 void coroutine_resume_im(coroutine_t *co),时,没有保证 coroutine_t 的状态为 Ready 或 Suspend 调用函数 void coroutine_resume_im(coroutine_t *co) 时,没有保证 coroutine_t 的状态为 Ready 或 Suspend May 29, 2019
@NianJi
Copy link
Collaborator

NianJi commented Jun 5, 2019

协程的block是有重入吗?理论上正常使用不应该进入这里

@jeffdgr8
Copy link

jeffdgr8 commented Jun 8, 2020

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.

@jeffdgr8
Copy link

After changing the Chans to Promises, the crash continues. So this isn't specifically caused by one or the other.

@NianJi
Copy link
Collaborator

NianJi commented Jun 11, 2020

Could you provide the demo code?

@jeffdgr8
Copy link

This seems to be resolved with a change I made to ensure canceling an active coroutine before dismissing a view controller.

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

No branches or pull requests

3 participants