Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/DataSnap/Server    [ Add a report in this area ]  
Report #:  106065   Status: Open
TDSServerModuleBase.Destroy did RemoveDataModule but no synchro
Project:  Delphi Build #:  XE, XE2
Version:    16.4 Submitted By:   snaper yoke
Report Type:  Crash / Data loss / Total failure Date Reported:  6/1/2012 2:10:47 AM
Severity:    Critical / Show Stopper Last Updated: 6/5/2012 12:13:26 AM
Platform:    All versions Internal Tracking #:   28717
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
////////////////////////////////////////////
destructor TDSServerModuleBase.Destroy;
begin
  //TDataModule
  if OldCreateOrder then DoDestroy;
  if Assigned(RemoveDataModule) then
    RemoveDataModule(Self);  // here
  //TComponent
  Destroying;
  RemoveFreeNotifications;
  DestroyComponents;
  // TPersistent
  RemoveFixups(Self);
  //TProviderDataModule
  CleanProviders;
end;
////////////////////////////////////////////////

look the "here" comment, do it need synchro, or donot call it because the base class called it.

you can understand, yes?

Now my solution is hook Classes.RemoveDataModule and do synchor.
Steps to Reproduce:
I upload my  reproduce sample, run the sample and click [Button1].
some minutes later, you will get a random error like
-------
Project2 throws exception class, EListError(message List index out of bounds(87)).
-------
it is random because the stack is break down.

////////////////////////////////////////////
destructor TDataModule.Destroy;
begin
  if not (csDestroying in ComponentState) then GlobalNameSpace.BeginWrite;
  try
    if OldCreateOrder then DoDestroy;
    if Assigned(RemoveDataModule) then
      RemoveDataModule(Self);
    inherited Destroy;
  finally
    GlobalNameSpace.EndWrite;
  end;
end;
////////////////////////////////////////////
I think you only need to see this function.
TDSServerModuleBase is inherit from TDataModule.

I also found my tester about this bug if you need, but I unknow how to upload the test project by my comment, can you help me?
Workarounds
Now my solution is hook Classes.RemoveDataModule and do synchor.
Attachment
testDataModuleListBug.zip
Comments

Tomohiro Takahashi at 6/1/2012 9:17:05 PM -
> Now my solution is hook Classes.RemoveDataModule and do synchor.
Could you tell us more detail about the 'synchor'?

and, could you please attach sample project to confirm your issue?

snaper yoke at 6/3/2012 10:04:24 PM -
destructor TDataModule.Destroy;
begin
  if not (csDestroying in ComponentState) then GlobalNameSpace.BeginWrite;
  try
    if OldCreateOrder then DoDestroy;
    if Assigned(RemoveDataModule) then
      RemoveDataModule(Self);
    inherited Destroy;
  finally
    GlobalNameSpace.EndWrite;
  end;
end;
////////////////////////////////////////////
I think you only need to see this function.
TDSServerModuleBase is inherit from TDataModule.

I also found my tester about this bug if you need, but I unknow how to upload the test project by my comment, can you help me?

snaper yoke at 6/3/2012 11:26:37 PM -
I upload my  reproduce sample, run the sample some minutes will get a random error. why is random because the stack is break down.

Tomohiro Takahashi at 6/4/2012 12:29:57 AM -
I built and ran attached application, then clicked [Button1].
So, sometimes I got several errors as below
---------
Project2 throws exception class, EListError(message List index out of bounds(87)).
...
---------

Is it your issue?

snaper yoke at 6/4/2012 12:55:13 AM -
Yes, I only new 100 threads new TDSServerModule, then delete it. then the random error occured.

Tomohiro Takahashi at 6/5/2012 5:45:54 PM -
This report was opened with valid Internal Tracking Number.
Thanks.

Server Response from: ETNACODE01