View Issue Details

IDProjectCategoryView StatusLast Update
0003990JEDI VCL00 JVCL Componentspublic2007-10-12 04:54
ReporterKiriakosAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.20 
Target VersionFixed in Version3.34 
Summary0003990: JvAppInstances.Check fails if many instances are started in short tiime interval
DescriptionJvAppInstances.Check uses the following if statement to check whether in needs to shut down.

if AppInstances.InstanceCount > MaxInstances then
  ...

The problem with this statement is that if many instances are started in a short time interval and given that instances are registered at component creation while the Check occurs when the form is loaded, it is possible that the check may fail for all instances.

Solution:
Replace with the following:

if AppInstances.InstanceIndex[GetCurrentProcessId] >= MaxInstances then
   ...


Another related bug is that the Check method calls
  TerminateProcess(GetCurrentProcess, 0);

to stop the instance. This is OK but it will not call the destructor of TJvAppInstances.AppInstances which calls RemoveInstance. In other words the InstanceCount will not be decreased when this instance is terminated. To resolve add the following Statement before the Terminate statement:

    AppInstances.Free; // Calls protected method RemoveInstance

TagsNo tags attached.

Activities

obones

2006-11-08 08:54

administrator   ~0010425

The second part, I'm quite sure it is fixed in the SVN version.
As to the first part, it might have been fixed as well.

Please use the more recent version and let us know.

http://homepages.borland.com/jedi/wiki/index.php?title=Repository

Kiriakos

2006-11-08 13:29

reporter   ~0010426

Indeed the second issue has been fixed but the first remains.

Kyle_Katarn

2007-06-15 13:41

reporter   ~0013328

Last edited: 2007-06-15 13:57

Bug confirmed for 1st part using latest available build.

Proposed solution fixes the problem flawlessly.

Obones, please apply for implementation

Kyle_Katarn

2007-06-15 13:52

reporter   ~0013329

Even with proposed fix crashes if multiple instances are created "simultaneously"

obones

2007-06-20 03:32

administrator   ~0013496

So in the end, what should be done?

Kyle_Katarn

2007-06-20 11:57

reporter   ~0013501

Conclusion of a deeper investigation :
- Crash was due to a mistake on my side : proposed solution is SAFE.

BUT it still has to be benckmarked because if multiple instances are loaded simultaneously (if the application is loaded thru the context menu of a selection of multiple files) it seems that sometimes all occurences are rejected.

Am i clear (not a native english speaker...) or do you need more details ?

obones

2007-10-12 04:54

administrator   ~0013912

Proposed fix is in SVN.
The potential bug with multi launch from the explorer will have to be looked at independently if it ever occurs.

Issue History

Date Modified Username Field Change
2006-11-06 21:14 Kiriakos New Issue
2006-11-08 08:54 obones Note Added: 0010425
2006-11-08 08:54 obones Status new => feedback
2006-11-08 13:29 Kiriakos Note Added: 0010426
2007-06-15 13:41 Kyle_Katarn Note Added: 0013328
2007-06-15 13:52 Kyle_Katarn Note Added: 0013329
2007-06-15 13:57 Kyle_Katarn Note Edited: 0013328
2007-06-20 03:32 obones Note Added: 0013496
2007-06-20 11:57 Kyle_Katarn Note Added: 0013501
2007-10-12 04:54 obones Status feedback => resolved
2007-10-12 04:54 obones Fixed in Version => Daily / SVN
2007-10-12 04:54 obones Resolution open => fixed
2007-10-12 04:54 obones Assigned To => obones
2007-10-12 04:54 obones Note Added: 0013912