Archived
This forum has been archived. Please start a new discussion on GitHub.
assert false when quiting
in Bug Reports
Recently, I had a trouble when using Ice3.4.2. Sometimes, an Ice assert is raised in ConnectionI.h #245 when my application is quiting.
It happens occasionally, so it puzzles me very much. By the way, only timeout proxy has the problem.
I have tried to analyze this problem by reviewing the source code of Ice3.4.2. And I guess that it is a bug in Ice3.4.2.
In ConnectionI::dispatch(ConnectionI.h #1442), the following code is added in Ice3.4.2.
//
// Decrease dispatch count.
//
if(!sentCBs.empty() || outAsync)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(--_dispatchCount == 0)
{
if(_state == StateClosing)
{
try
{
initiateShutdown();
}
catch(const LocalException& ex)
{
setState(StateClosed, ex);
}
}
else if(_state == StateFinished)
{
_reaper->add(this);
}
notifyAll();
}
}
Ice Assert is raised in initiateShutdown function. When a SocketOperationRead is retrieved from IOCP, first,
_readTimeout timer task is removed from the Timer through unscheduleTimeout(current.operation).
however _writeTimeout timer task still remains in it. Meanwhile, the application is quiting,
initiateShutdown is called and the program is trying to push _writeTimeout timer task into the Timer again,
bool inserted = _tasks.insert(make_pair(task, time)).second;
if(!inserted)
{
throw IllegalArgumentException(__FILE__, __LINE__, "task is already schedulded");
}
so the failure of the insert triggers an exception and then an assert is fired.
I have tried some ways to resolve it but no help, so how can I avoid this problem? and is it a bug in Ice3.4.2?
Thanks.
It happens occasionally, so it puzzles me very much. By the way, only timeout proxy has the problem.
I have tried to analyze this problem by reviewing the source code of Ice3.4.2. And I guess that it is a bug in Ice3.4.2.
In ConnectionI::dispatch(ConnectionI.h #1442), the following code is added in Ice3.4.2.
//
// Decrease dispatch count.
//
if(!sentCBs.empty() || outAsync)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(--_dispatchCount == 0)
{
if(_state == StateClosing)
{
try
{
initiateShutdown();
}
catch(const LocalException& ex)
{
setState(StateClosed, ex);
}
}
else if(_state == StateFinished)
{
_reaper->add(this);
}
notifyAll();
}
}
Ice Assert is raised in initiateShutdown function. When a SocketOperationRead is retrieved from IOCP, first,
_readTimeout timer task is removed from the Timer through unscheduleTimeout(current.operation).
however _writeTimeout timer task still remains in it. Meanwhile, the application is quiting,
initiateShutdown is called and the program is trying to push _writeTimeout timer task into the Timer again,
bool inserted = _tasks.insert(make_pair(task, time)).second;
if(!inserted)
{
throw IllegalArgumentException(__FILE__, __LINE__, "task is already schedulded");
}
so the failure of the insert triggers an exception and then an assert is fired.
I have tried some ways to resolve it but no help, so how can I avoid this problem? and is it a bug in Ice3.4.2?
Thanks.
0
Comments
-
Hi,
Thanks for the bug report! We have already fixed this bug on our mainline, the fix will be included in the next Ice release.
Cheers,
Benoit.0