socket resource exhaust

Hello,
I write a client and a server with Ice 3.6.1. The slice is very sample and few interfaces.
But, the client will send a large number of calls to server. A few days later, the sock of server
exhaust. Is it a bug of ice? What can i do? Please help me. Thanks.
file850 18349 root 12u sock 0,8 0t0 940597383 can't identify protocol
file850 18349 root 13u sock 0,8 0t0 940593371 can't identify protocol
file850 18349 root 14u sock 0,8 0t0 940820216 can't identify protocol
file850 18349 root 15u sock 0,8 0t0 940663999 can't identify protocol
file850 18349 root 16u sock 0,8 0t0 940871873 can't identify protocol
file850 18349 root 17u sock 0,8 0t0 940729868 can't identify protocol
file850 18349 root 18u sock 0,8 0t0 940594653 can't identify protocol
file850 18349 root 19u sock 0,8 0t0 940878789 can't identify protocol
the client props:
//设置Ice属性
//Get the initialized propert set
Ice::PropertiesPtr props = Ice::createProperties(argc, argv);
//Set the size of the server's thread pool
props->setProperty("Ice.ThreadPool.Client.Size", "5");
props->setProperty("Ice.ThreadPool.Client.SizeMax", "1000");
props->setProperty("Ice.ThreadPool.Server.Size", "5");
props->setProperty("Ice.ThreadPool.Server.SizeMax", "1000");
props->setProperty("Ice.ThreadPool.Server.ThreadIdleTime", "10");
props->setProperty("Ice.MessageSizeMax", "2048000");
props->setProperty("Ice.Override.ConnectTimeout", "10000");// 连接建立的超时时间是10秒
props->setProperty("Ice.Override.Timeout", "30000"); // 连接的超时时间ms,含建立连接、读、写、关闭等操作
props->setProperty("Ice.RetryIntervals", "-1"); // 禁止重试
props->setProperty("Ice.Default.EncodingVersion", "1.0");
//Initialize a communicator with these properties
Ice::InitializationData id;
id.properties = props;
the server props:
//设置Ice属性
//Get the initialized propert set
Ice::PropertiesPtr props = Ice::createProperties(argc, argv);
//Set the size of the server's thread pool
props->setProperty("Ice.ThreadPool.Client.Size", "5");
props->setProperty("Ice.ThreadPool.Client.SizeMax", "1000");
props->setProperty("Ice.ThreadPool.Server.Size", "5");
props->setProperty("Ice.ThreadPool.Server.SizeMax", "1000");
props->setProperty("Ice.ThreadPool.Server.ThreadIdleTime", "10");
props->setProperty("Ice.MessageSizeMax", "2048000");
props->setProperty("Ice.Override.ConnectTimeout", "10000"); // 连接建立的超时时间是10秒
props->setProperty("Ice.Override.Timeout", "30000"); // 连接超时时间是30秒,含建立连接、读、写、关闭连接等操作
props->setProperty("Ice.RetryIntervals", "-1"); // 禁止重试
//Initialize a communicator with these properties
Ice::InitializationData id;
id.properties = props;
Answers
Hi,
From your description, it sounds like there's a file descriptor leak. It's impossible to say however what could be the cause without additional information.
Could you provide a little more information on your application? For instance:
Ice.Trace.Network=1
on the server, can you verify that network connections for clients are correctly closed?Also, could you upgrade to the latest Ice 3.7.3 version or at least Ice 3.6.5?
Cheers,
Benoit
The slice:
module ied
{
struct GETFILE
{
string remoteFile;
string localFile;
};
sequence GetFileSeq;
The ice server app run function:
int CFile850App::run(int argc, char* argv[])
{
//This function creates an IceUtil::CtrlCHandler that shuts down the
//communicator when one of the monitored signals is raised.
shutdownOnInterrupt();
The ice server side interface implementation:
bool CIedFileI::connected(const ::std::string& ip, ::Ice::Int port, const ::Ice::Current& cur /* = Ice::Current() */)
{
SdlIec61850Client client(ip, port);
bool ret = client.initialize();
return ret;
}
The ice client side code:
iedFilePrx CShandong850I::get_iedfile_proxy()
{
try
{
string strUri = "IedFile:default -h 127.0.0.1 -p 10012";
Ice::CommunicatorPtr communicatorPtr = Ice::Application::communicator();
Ice::ObjectPrx objPrx = communicatorPtr->stringToProxy(strUri);
iedFilePrx filePrx = iedFilePrx::checkedCast(objPrx);
return filePrx;
}
catch (Ice::LocalException& e)
{
if (strstr(e.what(), "ConnectTimeoutException") != NULL)
{
kill_file850_program();
}
return NULL;
}
catch (Ice::Exception& e)
{
m_log.WriteALog(e.what());
return NULL;
}
catch (...)
{
m_log.WriteALog("readDirectory: unknown exception");
return NULL;
}
The ice client side program, having more than 100 threads. These threads mutual independence. All threads will send ice call to ice server from code above.
Hi,
Could you provide the information I asked in my previous post?
Also, did you try to run your server under a memory leak checker (e.g.: valgrind if using Linux) to see if it pointed out any obvious leaks?
We check each Ice release for memory leaks and there are no known leaks in Ice 3.6 or 3.7.
One thing you could also try to is to comment out the code that downloads the file with the SdlIec61850Client object and let run the client / server for a while while monitoring the FD usage.
Cheers,
Benoit
Hi,
Thanks very mush.
I write a test server and client. It works well. It perhaps libIEC61850's problem.