Changeset: f7a4076349a7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f7a4076349a7 Modified Files: gdk/gdk_utils.c monetdb5/modules/mal/clients.c Branch: Jul2021 Log Message:
Do clean up for exiting in the main thread. See bug #7167. diffs (52 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -877,6 +877,8 @@ GDKembedded(void) return Mbedded; } +static MT_Id mainpid; + gdk_return GDKinit(opt *set, int setlen, bool embedded) { @@ -888,6 +890,8 @@ GDKinit(opt *set, int setlen, bool embed int i, nlen = 0; char buf[16]; + mainpid = MT_getpid(); + if (GDKinmemory(0)) { dbpath = dbtrace = NULL; } else { @@ -1188,12 +1192,13 @@ GDKexiting(void) void GDKprepareExit(void) { - if (ATOMIC_ADD(&GDKstopped, 1) > 0) - return; + ATOMIC_ADD(&GDKstopped, 1); - TRC_DEBUG_IF(THRD) - dump_threads(); - join_detached_threads(); + if (MT_getpid() == mainpid) { + TRC_DEBUG_IF(THRD) + dump_threads(); + join_detached_threads(); + } } void diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -844,7 +844,7 @@ CLTshutdown(Client cntxt, MalBlkPtr mb, snprintf(buf, 1024,"%d client sessions still running",leftover); *ret = GDKstrdup(buf); if ( force) - mal_exit(0); + GDKprepareExit(); if (*ret == NULL) throw(MAL, "mal.shutdown", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list