xiaoxiang781216 commented on PR #6197: URL: https://github.com/apache/incubator-nuttx/pull/6197#issuecomment-1135055104
> > I amn't sure why you get crash here since the code exist for a long time. Yes, it isn't good to flush the stdio stream inside kernel, but it should work not crash at least. > > Call _exit() directly and it will crash. It is due to bad execution order. nxtask_exit() calls > > 1. nxsched_remove_readytorun(dtcb); > 2. ret = nxtask_terminate(dtcb->pid, true); > 3. nxtask_exithook(dtcb, EXIT_SUCCESS, nonblocking); > > Anything inside `nxtask_exithook()` that depends on `this_task()` fails. It calls `group_release()` which eventually ends up into `int nxsem_wait(FAR sem_t *sem) `where there is a test for the calling task `DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask());` > The assert is added recently: https://github.com/apache/incubator-nuttx/pull/5590. Of course, it isn't the problem of assertion, but the code self. > I don't remember which semaphore it was but calling ` _exit()` directly crashes the system for sure, either via that assert or by modifying something by calling `this_task()` and using what is returned. > > The group structure contains the files / streams / etc which should be released in userland, but they are now released when the group is released. Ok, let's fix the assertion in my upcoming patch. Anyway, it isn't the problem by this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org