Hi Evgeny,
Sorry it’s taken me a while to get back to this, it is our top priority for getting a XE2 / 64 bit version released, but as usual day to day things interrupt.
I’ve now been investigating further (after installing the latest ROSDK – 6.0.55.957) and I can now at least duplicate the problem at will in our software. I have not yet produced a simple test case that I can share, but here is some further information that I hope will help you point me in the right direction.
The attached screenshot now shows exactly where the problem is occurring, namely in uRoServer. TROInvoker.CustomHandleMessage, specifically the “mtd” call. As I’ve said, this is intermittent, but I can now get it to readily repeat by having two clients perform a long string of datasnap “execute” tasks simultaneously. I had thought the problem may be specific to 64 bit, but with this new test scenario, it is visible in 32 bit as well.
Of course it is at least reasonably likely that the problem is in my code, and I have attached a couple of pieces of source code that I feel may be at fault. The first is unRoPerClientClassFactory, which is my reworking or the PerClientClassFactory. Since I did this (around 2007), I know some of this functionality has been incorporated into the standard codebase and I need to look to see if I can remove my code as part of the investigation. I have also attached a sample _IMPL for a datamodule. It is not the one in question that has the problem – it does not do datasnap processing. However, I have included it because it is far shorter and it shows the general method I use for instantiating the data module. You will see the initialize procedure at the bottom which is called from the main form of the server. I do this in order to be able to specify a stored system parameter (AValue) which is a timeout value. You’ll see that I therefore do not create the class factory in the initialization, nor do I destroy it in the finalization. If it was in the initialization, how could I set a timeout that depended on a value being retrieved from a database ?
The only other area I have for investigation is something that I know is bad practice, but it is the result of a 10 year old code base… In order to execute a series of linked insert / delete / update statements we have in place a pseudo transactional model. That is, there are methods on the server to enable “StartTransaction”, “Commit” and “Rollback” functions. So if the client has a sequence that needs to all work or all fail, they are wrapped in calls to these methods. Although far from the ideal of a stateless server, it actually has been working well. I have done some investigation along the lines of removing the calls to these methods to see the impact, but it did not seem to make a difference.
In your earlier answer to me you mentioned IROObjectRetainer and TROObjectDisposer. I think I have seen these in a sample application, but I’m honestly not sure of their function or when to use them correctly.
If there are any avenues you can suggest to me at this stage, I would be most grateful as this is stopping us dead in our tracks with regards releasing the next version of our software.
Paul.