Archived

This forum has been archived. Please start a new discussion on GitHub.

vector<string> clean up bombs client

Hi all,

I am having a problem with my C++ client...
Everytime i return a string vector to the client my app bombs. I have narrowed it down to the vector clean up. Below are the errors (stack call) i get when it crashes -
>	DisplayClient.exe!std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::destroy(std::basic_string<char,std::char_traits<char>,std::allocator<char> > * _Ptr=0x003bf8b4)  Line 153 + 0x10	C++
 	DisplayClient.exe!std::_Destroy_range<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >(std::basic_string<char,std::char_traits<char>,std::allocator<char> > * _First=0x0012dfb8, std::basic_string<char,std::char_traits<char>,std::allocator<char> > * _Last=0x0043dfec, std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > & _Al={...})  Line 217 + 0x2e	C++
 	DisplayClient.exe!std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::_Tidy()  Line 797	C++
 	DisplayClient.exe!std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >()  Line 389	C++
 	DisplayClient.exe!COFares::FareItemT::~FareItemT()  + 0x7b	C++
 	DisplayClient.exe!COFares::FareItemT::`scalar deleting destructor'()  + 0x2b	C++

Ice declaration -

sequence<string> StringListT;

This causes problems whether the strings are static or dynamic. The server can load a single string into the vector and it will crash the client...

Dev Env:
C++
Window XP
Visual Studio .NET 2003
Ice-3.0.1

Any help would be greatly appreciated...
The default sequence i thought would take care of everything in C++... Am i wrong? Do i need to add something else in my .ice file?

--SD.

Comments

  • marc
    marc Florida
    Welcome to the forums! Please see this thread regarding our support policy.
  • thanks for the info marc, i don't normally add that much info but Ice is an outstanding product, so my updates are complete...
  • dwayne
    dwayne St. John's, Newfoundland
    Hi,

    We are not aware of any problems wrt vectors of strings. Could you provide a small code sample that reproduces the problem you are seeing?

    Regards,
    Dwayne
  • benoit
    benoit Rennes, France
    Also, you should make sure to not mix-up runtime libraries (you should link with iced.lib in debug mode and ice.lib in release mode). See this FAQ for more information.

    Cheers,
    Benoit.
  • thnx,
    I am using both debug run-time libraries for the client and server in debug mode and the list seems to work great with both C# and java clients, but for some reason not with C++. I can comment out the push_back insertion and things work great.

    Here is some of the code that i am using to insert -
    Fare.RoutingNbrList.push_back("05443");
    

    Here is some of the actual .ice definition file code -
    sequence<string> StringListT;
    	struct FareItemT
    	{
    	...
    		COCommon::StringListT 	RoutingNbrList;		
    	...			
    	};
    

    It is a simple sequence that generates a vector and inserts fine but in the call stack in the original post that when the client receives the returned data that the vector is being either copied and then destroyed and the client crashes...

    I can only assume that there is some null value that could be inserted on the end of the vector since is almost finishes cleaning the strings up when it bombs?

    I will work on a simple working example to try to duplicate it...
  • benoit
    benoit Rennes, France
    Hi,

    If you're using the debug runtime library, you should make sure that your client and server are correctly loading the debug Ice DLL (ice30d.dll) and the debug IceUtil DDL (iceutil30d.dll). You can check this with Dependency Walker for example.

    If everything looks fine, I would try to reproduce the crash by modifying for example the demo/Ice/hello demo provided with your Ice-3.0.1 distribution.

    Cheers,
    Benoit.
  • Thanx for all your advice... I actually wrote another simple component from scrach including a new .ice file and new client and everything went fine the vector was received and processed fine, so that can only mean that something is askew with my client code.

    I have actually been fighting this problem for months, so probably should have developed another client earlier on :o

    I will totally rewrite the client and see if that fixes things, thanx for your assistance...
  • If you don't have a problem with incorrectly link debug and release libraries, and you still see inexplicable crashes in things such as vector, chances are that memory was corrupted earlier. The point at which the crash happens in that case has pretty much nothing to do with where the damage was done. Purify is a useful tool to hunt down such problems.

    Cheers,

    Michi.
  • Well i created a fresh client project, copied the original code and recompiled...
    everything worked great, so i think you guys hit the nail on the head and somehow i had different libraries. From what i could tell nothing was different but somewhere there obviously was...

    ty once again for the assistance.