Archived
This forum has been archived. Please start a new discussion on GitHub.
Bad Allocation on stringToProxy?
Hello again, more problems moving our code base from 3.1.x->3.2b. Compiled with Visual Studio 2005 Express.
We are using Ice 3.2b on Win XP. The following commands worked in 3.1.x, but now throws a new exception:
The exception it throws is:
This is with an ipAddr and port that do not point to an IceBox server. This code is to catch when the ipAddr is specified wrong, and it does not resolve the TopicManager.
Ideas? I do not see anything in my code that would cause a bad_alloc, so it means something internal to Ice is causing that exception to throw. I would expect it should have been caught and rethrown as a Ice::Exception of the correct type.
We are using Ice 3.2b on Win XP. The following commands worked in 3.1.x, but now throws a new exception:
try { std::string stringProxy = "IceStorm/TopicManager:default -h "+ipAddrSender+" -p " + namePort; std::cout << "Publishing to Topic: " << nameTopic << " Proxy: " << stringProxy << std::endl; Ice::ObjectPrx obj = communicator->stringToProxy(stringProxy); } catch (const Ice::Exception & Error) { std::cout << typeid(Error).name() << std::endl; continue; } catch (std::exception & Error) { std::cout << typeid(Error).name() << std::endl; std::cout << Error.what() << std::endl; continue; } catch (...) { std::cout << "Got here" << std::endl; }
The exception it throws is:
class std::bad_alloc bad allocation
This is with an ipAddr and port that do not point to an IceBox server. This code is to catch when the ipAddr is specified wrong, and it does not resolve the TopicManager.
Ideas? I do not see anything in my code that would cause a bad_alloc, so it means something internal to Ice is causing that exception to throw. I would expect it should have been caught and rethrown as a Ice::Exception of the correct type.
0
Comments
-
From this description its impossible to tell you what is going on. What exactly throws the exception? Is the stringProxy somehow malformed? Did you try modifying the hello world demo in a similar way?
Btw, you can just print the exception directly.catch(const Ice::Exception& e) { cerr << "Ice::Exception: " << e << endl; }
0 -
stringToProxy throws. Also, how would stringProxy be malformed? It cout's just fine. Even if it were badly syntaxed, that would throw an Ice exception, not a std:: one.0
-
Could you post the exact string you are passing to stringToProxy?
Regards,
Dwayne0 -
Ice::ObjectPrx obj = communicator->stringToProxy("IceStorm/TopicManager:default -h 129.65.22.103 -p 3000");
That will throw.
I have stripped out the rest of the code, This still throwsint main(int argc, char ** argv) { Ice::CommunicatorPtr communicator; communicator = Ice::initialize(argc,argv); while(1) { try { Ice::ObjectPrx obj = communicator->stringToProxy("IceStorm/TopicManager:default -h 129.65.22.103 -p 3000"); break; } catch (const Ice::Exception & Error) { std::cout << typeid(Error).name() << std::endl; continue; } catch (std::exception & Error) { std::cout << typeid(Error).name() << std::endl; std::cout << Error.what() << std::endl; continue; } catch (...) { std::cout << "Got here" << std::endl; } } }
0 -
This looks as if there is something wrong with your build environment. Perhaps you are mixing old and new Ice libraries, or you are mixing debug code with release code? See also this FAQ. There is definitely nothing wrong with stringToProxy(). This is used by virtually every Ice application, including our tests and demos.0