bugCERTI - Bugs: bug #26610, rtig crashed when network error

 
 

bug #26610: rtig crashed when network error

Submitter:  Zhiyu Tang <musicear>
Submitted:  Tue 19 May 2009 12:52:43 AM UTC
   
 
Category:  CERTI Severity:  * 4 - Important
Item Group:  Software error Status:  Ready For Test
Privacy:  Public Assigned to:  erk
Open/Closed:  Closed Release:  * 3.3.2
Reproducibility:  Every Time Fixed Release:  * 3.3.3
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 28 May 2009 09:02:30 AM UTC, comment #3: 

Ok then .
I've just checked-in your fix.
It passes our [current] tests suite.

Eric NOULARD <erk>
Group administrator
Thu 28 May 2009 01:09:22 AM UTC, comment #2: 

I can make RTIG crash using such code:


#define RTI_USES_STD_FSTREAM
#include <string.h>
#include <stdlib.h>
#include <RTI.hh>
#include <windows.h>  
#include <sys/timeb.h>
#include <iostream>
using std::cout;
using std::cerr;
using std::endl;

int testcase()
{
RTI::FederateAmbassador *fedAmb;
RTI::RTIambassador       rtiAmb;
RTI::FederateHandle      federateId;

rtiAmb.createFederationExecution( "hello", "HelloWorld.fed" );
federateId = rtiAmb.joinFederationExecution( "test1",
"hello",
fedAmb);


cerr << "Do something wrong to make RTIA crash"<< endl;

rtiAmb.registerObjectInstance( 1 );
cerr << "Now RTIG crashed!"<< endl; 
return 0;
}

int main()
{
testcase(); 
}

These code was complied in  Visual Studio 2008 and make
RTIG crash every time.

My fix works on my test case.
 

Zhiyu Tang <musicear>
Wed 27 May 2009 05:23:08 PM UTC, comment #1: 

Sounds good, we should not
try to ++ a modified iterator which may already be at the end.

Can you describe how you make RTIG crash?
Do you kill a federate?
Do you unplug the network cable?

Does your fix works on your test case?

Eric NOULARD <erk>
Group administrator
Tue 19 May 2009 12:52:43 AM UTC, original submission:  

ritg throw exception: map/set iterator not increment when network error.

I think the funcion killFederate in ObjectSet.cc

void ObjectSet::killFederate(FederateHandle the_federate)
    throw (RTIinternalError)
{
    std::map<ObjectHandle, Object *>::iterator i ;
    for (i = begin(); i != end(); i++) {
        if ((i->second)->getOwner() == the_federate) {
            std::map<ObjectHandle, Object *>::erase(i);
            i = begin();
        }
    }
}

should change to

void
ObjectSet::killFederate(FederateHandle the_federate)
    throw (RTIinternalError)
{
    std::map<ObjectHandle, Object *>::iterator i = begin();
while( i != end() )
{
            if ((i->second)->getOwner() == the_federate) {
               std::map<ObjectHandle, Object *>::erase(i);
               i = begin();
            }
    else
       i++;
         }
}

Zhiyu Tang <musicear>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by erk (Posted a comment)
  • -email is unavailable- added by musicear (Submitted the item)
  •  

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-10-21 erk Open/ClosedOpen Closed
        Fixed ReleaseCVS 3.3.3
    2009-05-28 erk StatusNeed Info Ready For Test
        ReleaseCVS 3.3.2
    2009-05-27 erk StatusNone Need Info
        Assigned toNone erk

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code