Changeset: 644094b03154 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=644094b03154
Modified Files:
gdk/gdk_utils.c
monetdb5/mal/mal_scenario.c
monetdb5/mal/mal_session.c
monetdb5/modules/mal/mal_mapi.c
sql/server/sql_mvc.c
Branch: default
Log Message:
Attempt to solve timeouts on Windows.
The timeouts occur due to a deadlock during exit. The deadlock
happens somewhere deep inside the C runtime.
We now try to have threads exit voluntarily when GDKexit is called,
and GDKexit waits a short while before terminating left over threads.
diffs (81 lines):
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1319,6 +1319,7 @@ GDKexit(int status)
MT_join_thread(GDKvmtrim_id);
GDKnrofthreads = 0;
MT_lock_unset(&GDKthreadLock, "GDKexit");
+ MT_sleep_ms(50);
/* Kill all threads except myself */
if (status == 0) {
diff --git a/monetdb5/mal/mal_scenario.c b/monetdb5/mal/mal_scenario.c
--- a/monetdb5/mal/mal_scenario.c
+++ b/monetdb5/mal/mal_scenario.c
@@ -544,7 +544,7 @@ runScenarioBody(Client c)
#ifdef HAVE_TIMES
times(&t0);
#endif
- while (c->mode > FINISHING || msg != MAL_SUCCEED) {
+ while ((c->mode > FINISHING || msg != MAL_SUCCEED) && !GDKexiting()) {
if (msg != MAL_SUCCEED){
/* we should actually show it [postponed]
mnstr_printf(c->fdout,"!%s\n",msg);
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -431,8 +431,8 @@ MSserveClient(void *dummy)
if (c->mode == FINISHING)
break;
resetScenario(c);
- } while (c->scenario);
- } while (c->scenario && c->mode != FINISHING);
+ } while (c->scenario && !GDKexiting());
+ } while (c->scenario && c->mode != FINISHING && !GDKexiting());
}
/*
* At this stage we should clean out the MAL block
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -207,6 +207,8 @@ SERVERlistenThread(SOCKET *Sock)
msgsock = usock;
#endif
retval = select((int)msgsock + 1, &fds, NULL, NULL, &tv);
+ if (GDKexiting())
+ break;
if (retval == 0) {
/* nothing interesting has happened */
continue;
@@ -315,8 +317,8 @@ SERVERlistenThread(SOCKET *Sock)
doChallenge(
socket_rastream(msgsock, "Server read"),
socket_wastream(msgsock, "Server write"));
- } while (1);
- /*return;*/ /* never reached as while loop only exits with "goto error"
*/
+ } while (!GDKexiting());
+ return;
error:
fprintf(stderr, "!mal_mapi.listen: %s, terminating listener\n", msg);
}
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -148,13 +148,17 @@ mvc_exit(void)
void
mvc_logmanager(void)
{
+ Thread thr = THRnew("logmanager");
store_manager();
+ THRdel(thr);
}
void
mvc_minmaxmanager(void)
{
+ Thread thr = THRnew("minmaxmanager");
minmax_manager();
+ THRdel(thr);
}
int
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list