Hello, I've looked through the lifecycle FileSystem example and I think there's
a design issue that allows executing operation on an already destroyed ice object.
Consider this scenario:
We have an empty directory and 2 threads:
1.Thread A calls DirectoryI::createDirectory locks mutex m_, asserts that object isn't destroyed and unlocks m_, at this point scheduler starts thread B.
2.Thread B calls DirectoryI::destroy, since there're no files in directory it is removed from object adapter, added to reap map and marked as 'destroyed'.
3.Thread A continues execution, locks lcMutex_, creates and activates new directory with an already destroyed parent.
as a solution, i think we should write:
right afterCode:if(_destroyed) { throw ObjectNotExistException(__FILE__, __LINE__, c.id, c.facet, c.operation); }
in DirectoryI::createDirectory and all other similar functionsCode:IceUtil::StaticMutex::Lock lock(_lcMutex);
Or I'm missing something and the present code is ok ?

Reply With Quote