Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8681

Modified Files:
        mal.mx 
Log Message:
Defense against closing the server while there appear to exist clients.
Running against the test set show numerous tests where mclient termination
is not detected. Probably a protocol/stream error in the context of
terminating processes.


Index: mal.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal.mx,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- mal.mx      16 May 2007 21:20:08 -0000      1.121
+++ mal.mx      29 May 2007 19:40:24 -0000      1.122
@@ -374,11 +374,32 @@
 memory leakage problems later on.
 @c
 void mal_exit(void){
-       int t = 0;
+       int t = 0, activeClients, reruns=0;
        str err;
+       Client cntxt = mal_clients;
 
[EMAIL PROTECTED]
+Before continuing we should make sure that all clients
+(except the console) have left the scene.
[EMAIL PROTECTED]
+       if( MCgetClient() != mal_clients){
+                       stream_printf(mal_clients->fdout,"#MALexit: non-admin 
attempt\n");
+               return;
+       }
+       do{
+               activeClients=0;
+               for(cntxt= mal_clients+1;  cntxt<mal_clients+MAL_MAXCLIENTS; 
cntxt++)
+               if( cntxt->mode != FREECLIENT)
+                       activeClients++;
+               if( activeClients) {
+                       stream_printf(mal_clients->fdout,"#MALexit: clients 
still active\n");
+                       MT_sleep_ms(1000);
+               }
+       } while (activeClients && reruns++ < 3);
+       if( reruns== 3)
+               stream_printf(mal_clients->fdout,"#MALexit: server forced 
exit\n");
[EMAIL PROTECTED]
 #if 0
-       Client cntxt = mal_clients;
        /* skip this to solve random crashes, needs work */
        freeBoxes();
        freeModuleList(cntxt->nspace);
@@ -404,7 +425,6 @@
                (void) stream_destroy(cntxt->fdout);
        }
 #endif
-
        /* deregister everything that was registered, ignore errors */
        if ((err = SABAOTHwildRetreat(&t)) != MAL_SUCCEED) {
                fprintf(stderr, "!%s", err);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to