Changeset 1193


Ignore:
Timestamp:
07/03/17 16:45:10 (4 years ago)
Author:
oabramkina
Message:

Two server levels: fixing a bug during context finalization. The last buffer check for the connection from server (classical or primary) to client must be blocking. Otherwise it's possible to have lost messages sent by server to client causing a deadlock on the side of client at context finalization.

Location:
XIOS/dev/dev_olga/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/context_client.cpp

    r1184 r1193  
    451451 
    452452   CTimer::get("Blocking time").resume(); 
    453 //    while (!stop) 
     453//   while (!stop) 
    454454   { 
    455455     checkBuffers(); 
    456456     if (hasTemporarilyBufferedEvent()) 
    457457       sendTemporarilyBufferedEvent(); 
    458  
    459458     stop = true; 
     459//     for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) stop &= !itBuff->second->hasPendingRequest(); 
    460460   } 
    461461   CTimer::get("Blocking time").suspend(); 
  • XIOS/dev/dev_olga/src/context_server.cpp

    r1158 r1193  
    237237    else if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_POST_FINALIZE) 
    238238    { 
    239       info(20)<<"Server side context <"<<context->getId()<<"> finalized."<<endl; 
     239      info(20)<<" CContextServer: Receive context <"<<context->getId()<<"> finalize."<<endl; 
    240240      context->postFinalize(); 
    241241    } 
  • XIOS/dev/dev_olga/src/node/context.cpp

    r1188 r1193  
    444444 
    445445       // (Last) context finalized message received 
    446        // Close files, gather registries, send context finalize to its parent context 
    447446       if (countChildCtx_ == clientPrimServer.size()) 
    448447         client->finalize(); 
     
    455454   * \fn void CContext::postFinalize(void) 
    456455   * Close files, gather registries, and make deallocations. 
    457    * Function is called when a context is finalized (it has nothing to receive and nothing to send). 
     456   * Function is called when a context is finalized. 
    458457   */ 
    459458   void CContext::postFinalize(void) 
     
    475474     } while (!buffersReleased); 
    476475 
    477      info(20)<<"Context <"<<getId()<<"> is finalized."<<endl; 
     476     // Primary or classical server: block until all messages are sent to model 
     477     // Client (model): block until all messages are sent to server 
     478     if ( CServer::serverLevel==0 || CServer::serverLevel==1 || !hasServer) 
     479     do 
     480     { 
     481       client->checkBuffers(); 
     482       buffersReleased = !client->havePendingRequests(); 
     483     } while (!buffersReleased); 
    478484 
    479485     if (hasServer && !hasClient) 
     
    493499       MPI_Comm_free(&(*it)); 
    494500     comms.clear(); 
     501 
     502     info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 
    495503 
    496504   } 
     
    12391247     { 
    12401248       CFile* file = this->enabledFiles[i]; 
    1241 //       if (file->getContextClient() == contextClient) 
     1249       if (file->getContextClient() == contextClient) 
    12421250       { 
    12431251         CFile::mode_attr::t_enum fileMode = file->mode.isEmpty() ? CFile::mode_attr::write : file->mode.getValue(); 
Note: See TracChangeset for help on using the changeset viewer.