Archived
This forum has been archived. Please start a new discussion on GitHub.
Get "Assertion failed" in ConnectionMonitor.cpp, with Ice-3.0.1-VC80
I get a problem in my VC++ code:
"Assertion failed!
File: .\ConnectionMonitor.cpp
Line: 65
Expression: !_instance
version: Ice-3.0.1-VC80
platform: Win XP SP2
compile: VS 2005
code:
I want to test how many clients can my server support,
In the class VDClient
=======
bool VDClient::InitClient(string strMac, string strServerIP, string strPort =
"10040", string strTimeout = "5000")
{
try
{
int argc = 0;
//Ice::InitializationData initData;
Ice::PropertiesPtr properties = Ice::createProperties();
//
// Set a default value for "Hello.Proxy" so that the demo will
// run without a configuration file.
//
m_strMac = strMac;
string strVDSrvProxy = "VDSrvCtrl:tcp -h ";
strVDSrvProxy += strServerIP;
strVDSrvProxy += " -p " + strPort;
strVDSrvProxy += " -t " + strTimeout;
properties->setProperty("VDSrv.Proxy", strVDSrvProxy);
properties->setProperty("Client.Endpoionts", "tcp");
//initData.properties->setProperty("Ice.ThreadPool.Client.Size",
"5");
//initData.properties->setProperty("Ice.ThreadPool.Client.SizeMax",
"10");
communicator = Ice::initializeWithProperties(argc, 0, properties);
VDPrx = VD::VDSrvPrx::checkedCast(communicator->stringToProxy
(properties->getProperty("VDSrv.Proxy")));
if(!VDPrx)
{
string err = "ErrorMessage";
GlobalFunc::instance()->PrintMessage(err);
return false;
}
std::string _uuid = IceUtil::generateUUID();
ident.name = _uuid;
ident.category = "";
clientAdapter = communicator->createObjectAdapter(properties-
>getProperty("Client"));
ptrVDClient = new VDClientProxyI();
clientAdapter->add(ptrVDClient, ident);
clientAdapter->activate();
VDPrx->ice_connection()->setAdapter(clientAdapter);
return true;
}
catch(const Ice::Exception& ex)
{
ostringstream ostr;
ostr << ex;
string s = ostr.str();
string err = "Error:" + s;
VDPrx = NULL;
GlobalFunc::instance()->PrintMessage(err);
return false;
}
catch (...)
{
VDPrx = NULL;
GlobalFunc::instance()->PrintMessage("Error");
return false;
}
}
=========
===========
for (int i = 0; i < MaxClientNum; i++)
{
VDClient* pVD = new VDClient();
pVD->InitClient("8888", "192.168.101.87", "10040", "5000");
DoSomething();
delete pVD;
pVD = NULL;
}
===========
when MaxClientNum is 1000 or larger, I get the above problem, how can i fix it,
Thanks!
VDSrv.ice
===========
#ifndef VD_ICE_PC
#define VD_ICE_PC
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
module MapC
{
dictionary<string, string> Context;
};
module VD
{
interface VDSrv
{
MapC::Context RequestToServer();
void HeartBeatRegister(Ice::Identity ident);
};
};
#endif
================
VDClientProxy.ice
====================
#ifndef VDClient_ICE_PC
#define VDClient_ICE_PC
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
module VDProxy
{
interface VDClientProxy
{
void SendMessage();
};
};
#endif
================
"Assertion failed!
File: .\ConnectionMonitor.cpp
Line: 65
Expression: !_instance
version: Ice-3.0.1-VC80
platform: Win XP SP2
compile: VS 2005
code:
I want to test how many clients can my server support,
In the class VDClient
=======
bool VDClient::InitClient(string strMac, string strServerIP, string strPort =
"10040", string strTimeout = "5000")
{
try
{
int argc = 0;
//Ice::InitializationData initData;
Ice::PropertiesPtr properties = Ice::createProperties();
//
// Set a default value for "Hello.Proxy" so that the demo will
// run without a configuration file.
//
m_strMac = strMac;
string strVDSrvProxy = "VDSrvCtrl:tcp -h ";
strVDSrvProxy += strServerIP;
strVDSrvProxy += " -p " + strPort;
strVDSrvProxy += " -t " + strTimeout;
properties->setProperty("VDSrv.Proxy", strVDSrvProxy);
properties->setProperty("Client.Endpoionts", "tcp");
//initData.properties->setProperty("Ice.ThreadPool.Client.Size",
"5");
//initData.properties->setProperty("Ice.ThreadPool.Client.SizeMax",
"10");
communicator = Ice::initializeWithProperties(argc, 0, properties);
VDPrx = VD::VDSrvPrx::checkedCast(communicator->stringToProxy
(properties->getProperty("VDSrv.Proxy")));
if(!VDPrx)
{
string err = "ErrorMessage";
GlobalFunc::instance()->PrintMessage(err);
return false;
}
std::string _uuid = IceUtil::generateUUID();
ident.name = _uuid;
ident.category = "";
clientAdapter = communicator->createObjectAdapter(properties-
>getProperty("Client"));
ptrVDClient = new VDClientProxyI();
clientAdapter->add(ptrVDClient, ident);
clientAdapter->activate();
VDPrx->ice_connection()->setAdapter(clientAdapter);
return true;
}
catch(const Ice::Exception& ex)
{
ostringstream ostr;
ostr << ex;
string s = ostr.str();
string err = "Error:" + s;
VDPrx = NULL;
GlobalFunc::instance()->PrintMessage(err);
return false;
}
catch (...)
{
VDPrx = NULL;
GlobalFunc::instance()->PrintMessage("Error");
return false;
}
}
=========
===========
for (int i = 0; i < MaxClientNum; i++)
{
VDClient* pVD = new VDClient();
pVD->InitClient("8888", "192.168.101.87", "10040", "5000");
DoSomething();
delete pVD;
pVD = NULL;
}
===========
when MaxClientNum is 1000 or larger, I get the above problem, how can i fix it,
Thanks!
VDSrv.ice
===========
#ifndef VD_ICE_PC
#define VD_ICE_PC
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
module MapC
{
dictionary<string, string> Context;
};
module VD
{
interface VDSrv
{
MapC::Context RequestToServer();
void HeartBeatRegister(Ice::Identity ident);
};
};
#endif
================
VDClientProxy.ice
====================
#ifndef VDClient_ICE_PC
#define VDClient_ICE_PC
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
module VDProxy
{
interface VDClientProxy
{
void SendMessage();
};
};
#endif
================
0
Comments
-
Hi,
We only provide free support on the forums for the latest Ice version. Could you upgrade to 3.2.1 and see if you still get this assert?
Thanks,
Cheers,
Benoit.0 -
ok
I'll try it
Thanks0