Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice Thread Pool problem
Hi!
I've a problem in developing project with Ice 3.3.1 vs CodeGear 2009 SP4, wich works on Windows XP SP3.
My client-server applicaion works with session factory, timestamp and garbage thread (demo Sessions).
I add method GetResult (std:string& s, Ice::Current &) to the class SessionI, which uses client application to get data from the server:
Then i described method GetResultin module SessionI.cpp:
In method GetParseString of class OraProxy I try to allocate memory for field lname using code:
Now about problem. When clients connect to the server, which started whith parameter Ice.ThreadPool.Server.Size=1, all works well, but very slowly. But when i make Ice.ThreadPool.Server.Size more,then 1, my server works some time and then falls with Access violation error while executing method executing_statement.
P.S. I change type of field lname to vector and try to allocate memory with method resize(), but nothing changed.
Regards.
I've a problem in developing project with Ice 3.3.1 vs CodeGear 2009 SP4, wich works on Windows XP SP3.
My client-server applicaion works with session factory, timestamp and garbage thread (demo Sessions).
I add method GetResult (std:string& s, Ice::Current &) to the class SessionI, which uses client application to get data from the server:
class SessionI : public Demo::Session, public IceUtil::Mutex { public: SessionI(const std::string&); virtual Demo::HelloPrx createHello(const Ice::Current&); virtual void refresh(const Ice::Current&); virtual std::string getName(const Ice::Current&) const; virtual void destroy(const Ice::Current&); virtual void GetResult (std:string& s, Ice::Current &); IceUtil::Time timestamp() const; .... };
Class OraProxy: class OraProxy: puclic Ice::Object { private: char *lname; .... public: GetParseString(string& result_string); }; typedef IceUtil::Handle<OraProxy> OraProxyPtr;
Then i described method GetResultin module SessionI.cpp:
void SessionI::GetResult(std::string& s,const Ice::Current&) { OraProxyPtr op=new OraProxy(); op->GetParseString(s); ... }
In method GetParseString of class OraProxy I try to allocate memory for field lname using code:
void OraProxy::executing_statement(std::string& result_string) { numcols = 3; lname=(char*)calloc(1,numcols*MAXFETCH*((MAXLEN+1)*2)); .... free (lname); result_string = ...; }
Now about problem. When clients connect to the server, which started whith parameter Ice.ThreadPool.Server.Size=1, all works well, but very slowly. But when i make Ice.ThreadPool.Server.Size more,then 1, my server works some time and then falls with Access violation error while executing method executing_statement.
P.S. I change type of field lname to vector and try to allocate memory with method resize(), but nothing changed.
Regards.
0
Comments
-
Hi and welcome to the forums!
Did you manage to get a stack trace of the access violation to see if it helped narrowing down the issue? In any case, could you try with the latest Ice version and C++Builder 2010? We only support the latest Ice version for free here on the forums.
Cheers,
Benoit.0 -
Ice Thread Pool problem
Hi, Benoit!
I got stack trace, it says that after execution of function calloc raises exception (check attachment)
Fuction calloc in my example allocates 750000 bytes. I change linker parameters heap size, maximum and stack size maximum to 0x100000 and tried to use Ice parameter Ice.ThreadPool.Server.StackSize=16777216, but no result.
Also i wrote an algoritm, wich concatenates std::string string variables into result variable in cycle and got an acception in deallocation of memory.
Thanks for help!0 -
Do you have any synchronization in place around the executing_statement method to prevent multiple threads from calling it concurrently? If not that could cause issues as you appear to be allocating/freeing a shared member variable in that function.0
-
Hi, Dwayne!
If i use IceUtil::Mutex, everything is ok:) , but i want to execute this method in parallel mode.
I use fields of the class OraProxy in the method executing_statement. When client connects to the server, I create a new object of the class OraSession, wich has local variables-fields for each object, not shared.
If i made a mistake,correct me, please.
Thank you for the help!0 -
I encountered a similar problem.
I have a slice define like this:
class server
{
void savedata(string data);
}
in savedata method,I use Oracle OCCI to save data.
When I set the server thread pool size=1,all is ok,but when setting the size more then 1,the server process will make a hard CPU usage (99% above).
env:
VC 8.0
ICE 3.3.1
windows XP SP2;0 -
Hi,
This most likely indicates a thread safety issue with your code or with 3rd party code called from your servants. I recommend attaching to the process to see what the Ice server thread pool threads are doing, this might provide some hints on the cause of the hang.
Cheers,
Benoit.0 -
https://forums.oracle.com/forums/thread.jspa?threadID=422312
Maybe it's oracle bug.
I solve the problem use Application-Provided Serialization.
You get more info from below link:
Optimizing Performance of OCCI Applications0