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

 
 

bug #26610: rtig crashed when network error

Submitted by:  Zhiyu Tang <musicear>
Submitted on:  Tue 19 May 2009 12:52:43 AM UTC  
 
Category: CERTISeverity: 4 - Important
Item Group: Software errorStatus: Ready For Test
Privacy: PublicAssigned to: Eric NOULARD <erk>
Open/Closed: ClosedRelease: 3.3.2
Reproducibility: Every TimeFixed Release: 3.3.3

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 21 Oct 2009 09:52:41 AM UTCerkOpen/ClosedOpen=>Closed
      Fixed ReleaseCVS=>3.3.3
    Thu 28 May 2009 09:02:30 AM UTCerkStatusNeed Info=>Ready For Test
      ReleaseCVS=>3.3.2
    Wed 27 May 2009 05:23:08 PM UTCerkStatusNone=>Need Info
      Assigned toNone=>erk

    Back to the top


    Powered by Savane 3.1-cleanup1