0

I noticed something while testing some of my code on a Windows XP 32-bit virtual machine: My application always kept hanging. I never had such phenomenon on my Windows 7 64-bit computer but it was 100% reproducible on the VM.
Via remote debugging i found out that the program was hanging on a call of IOmniTaskControl.WaitForInit. I set a breakpoint in TOmniWorker.Initialize but it was not triggered.

This is the method where I create the task:

constructor TThreadedImportCache.Create(
  const AImportCacheConstructorParams: TImportCacheConstructorParamsWrapper);
begin
  inherited Create;

  FIsFlushingCounter := CreateCounter;

  FWorker      := TImportCacheWorker.Create(AImportCacheConstructorParams, FIsFlushingCounter);
  FTaskControl := CreateTask(FWorker, BuildUniqueIdent(TImportCacheWorker.ClassName));
  FTaskControl.Unobserved;
  FTaskControl.Schedule;
end;

When I replace FTaskControl.Schedulewith FTaskControl.Run the task is initialized, runs fine and my application does not freeze.

My question(s):

  1. Have I been misusing the Schedule call? I thought it was the one to use, as it's not waiting to be actually run and the task is started some short time later. How is it supposed to be used?

    or

  2. Is this some problem/incompatibility concerning threading (via OmniThreadLibrary) on Windows XP?

Community
  • 1
  • 1
René Hoffmann
  • 2,766
  • 2
  • 20
  • 43
  • This looks like a bug in OTL. Are you trying this with the official release or with the latest SVN version? – gabr Jan 02 '15 at 15:43
  • I currently use *Revision 1346* from http://omnithreadlibrary.googlecode.com/svn – René Hoffmann Jan 02 '15 at 15:53
  • Can you please try the latest revision? – gabr Jan 02 '15 at 16:35
  • Another thing to check - is maybe this behaviour related to how many cores are available in the VM? – gabr Jan 02 '15 at 16:35
  • @gabr I'll check both and tell you in a few days. Thanks, so far. OTL is a great piece of work. – René Hoffmann Jan 02 '15 at 16:47
  • @gabr I've got some results now: (1) I experienced the same behaviour with latest revision 1363, unfortunally. (2) Indeed, the behaviour seems to be related to the number of cores. At first (when I noticed the problem), the VM had only 1 core. After setting the number of cores to 2, it runs fine again. – René Hoffmann Jan 05 '15 at 08:23
  • I'll check this in a VM. Must be a deadlock issue in OTL. – gabr Jan 05 '15 at 09:04
  • @gabr For now, I'll just use the `.Run` call and put to-dos in my code, so that I can change it when there's a fix. Is there some easy way of being notified? – René Hoffmann Jan 07 '15 at 08:02
  • Can't repeat this with the current SVN version. Can you please retest? If it still fails, can you provide me with a minimal program that fails? – gabr Feb 17 '15 at 19:19

0 Answers0