event: check that all non-app threads have exited at shutdown

For now, just print a loud warning when this case is
violated.  We will add a hard assertion and cause the app
to exit with error status in a later release.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic9226f76a4729820f13a2728bea977b6a54f48ee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15513
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Jim Harris 2022-11-17 06:21:18 +00:00 committed by Tomasz Zawadzki
parent 8203e68e24
commit 1d2700d4c1

View File

@ -964,8 +964,18 @@ reactor_run(void *arg)
TAILQ_FOREACH(lw_thread, &reactor->threads, link) {
thread = spdk_thread_get_from_ctx(lw_thread);
spdk_set_thread(thread);
spdk_thread_exit(thread);
/* All threads should have already had spdk_thread_exit() called on them, except
* for the app thread.
*/
if (spdk_thread_is_running(thread)) {
if (thread != spdk_thread_get_app_thread()) {
SPDK_ERRLOG("spdk_thread_exit() was not called on thread '%s'\n",
spdk_thread_get_name(thread));
SPDK_ERRLOG("This will result in a non-zero exit code in a future release.\n");
}
spdk_set_thread(thread);
spdk_thread_exit(thread);
}
}
while (!TAILQ_EMPTY(&reactor->threads)) {