Code Monkey home page Code Monkey logo

omnithreadlibrary's People

Contributors

gabr42 avatar jpluimers avatar mkhpavel avatar vincentparrett avatar vypu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omnithreadlibrary's Issues

Wish: ForEach starting from dynamic array directly

Imagine I read tasks (one per line) via TFile.ReadAllLines('file.txt');

Now how can I start the loop? I need three tedios indirecton layers.

Var v: TOmniValue; c: IOmniBlockingCollection;

{1} v := TOmniValue.FromArray( TArray(TFile.ReadAllLines('file.txt')));
{2} c := TOmniBlockingCollection.Create; c.Add(v);
{3} Parrallel.ForEach( c )....

To reduce boilerplate it would be nice to have

1: Parrallel.ForEach(const Source: TArray);

2: just like there is TOmniCollection.ToArray - there may be TOmniCollection.FromArray (if there cannot be type-cast operator with generics)

InitializeGlobals in DSiWin32FU.pas changes global Windows timer resolution to 1ms indefinetely

TOTPWorker.Initialize in OTLThreadPull.pas changes global Windows timer resolution to 1ms

function TOTPWorker.Initialize: boolean;
...
  Task.SetTimer(1, 1000, @TOTPWorker.MaintainanceTimer);

This might be unneeded and wastes too much energy
https://randomascii.wordpress.com/2016/03/08/power-wastage-on-an-idle-laptop/
https://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/
especially on the laptop on battery.
OTL is used in RFindUnit Delphi addon which causes fast timer running until Delphi IDE is closed.

AV Thrown using a ThreadPool Task

Using Thread pool with Monitor in 64 bit environment throws ACCES
thread_pool_test.zip
S_VIOLATION exception.

Here is a piece of code I’ve for re-creating an issue.

if cbThreadPool.Checked then
begin

// create thread pool
FThreadPool := CreateThreadPool('Test thread pool')
               .MonitorWith(OmniEventMonitor);

// create task
task := CreateTask(TTestWorker.Create(Handle), 'Test task')
        .MonitorWith(OmniEventMonitor)
        .Schedule(FThreadPool);

end
else
begin

// create task
task := CreateTask(TTestWorker.Create(Handle), 'Test task')
        .MonitorWith(OmniEventMonitor)
        .Run;

end;
I am submitting a report on behalf of a developer on my team:

  1. Then task created and executed by using Thread Pool, it immediately throws ACCESS_VIOLATION exception in the line
    pool := emMonitoredPools.ValueOf(tpMonitorInfo.UniqueID) as IOmniThreadPool;
    in procedure TOmniEventMonitor.WndProc(var msg: TMessage);
    Call Stack goes all the way to Application.ProcessMessage.
  2. Then task created and executed – no issues at all.

In 32 bit environment both cases works fine.

Test environment:
Delphi 10 Seattle
Omni Thread Library – 3.05. Actually can’t say for sure. History.txt looks like misses label for latest version.

DSiAddApplicationToFirewallExceptionList fails on Windows XP

DSiAddApplicationToFirewallExceptionList() raises exception "Unknown 
resolveConflict value 2" if called on Windows XP like this:

if DSiAddApplicationToFirewallExceptionList(
  'FirebirdSQL',            // entryName
  '',                       // applicationFullPath
  rcSkip,                   // resolveConflict
  'Firebird SQL Server',    // description
  '',                       // grouping
  '',                       // serviceName
  [fwProtoTCP],             // protocols
  '3050',                   // localPorts
  [fwProfilePrivate, fwProfilePublic, fwProfileDomain] // profiles
then...

This is due to a missing semicolon in the fallback-code 
DSiFindApplicationInFirewallExceptionListXP() just before the "else"-case:

function DSiAddApplicationToFirewallExceptionListXP(...
...
case resolveConflict of
  rcDuplicate:
    {nothing to do};
  rcOverwrite:
    DSiRemoveApplicationFromFirewallExceptionListXP(....
  rcSkip:
    if DSiFindApplicationInFirewallExceptionListXP(entryName, app, profile) then begin
      Result := true;
      Exit;
    end; <<< add semicolon!
  else
    raise Exception.CreateFmt('Unknown resolveConflict...'


Original issue reported on code.google.com by [email protected] on 6 May 2011 at 11:59

task.Terminated does not work as expected

Instead of 'if task.Terminated' use

if WaitForSingleObject(task.TerminateEvent, 0) = WAIT_OBJECT_0 then

I do agree that this is my problem - bad object interface. Terminated 
signals whether the task has been fully stopped, not whether it should 
terminate.

Original issue reported on code.google.com by gabr42 on 1 Nov 2008 at 9:41

Change exception handling

- by default exceptions in tasks should be visible
- owner should call .SilentExceptions to switch to the current 
implementation
- we need custom per-task exception handlers

Original issue reported on code.google.com by gabr42 on 18 Feb 2009 at 8:26

Improve or warn about ReceiveWait and creating task with function

Hello,
i just figured out that ReceiveWait will also receive internal messages. Lets say i create a task and say execute the Execute procedure:

CreateTask(TMyOmniWorker.Create(True)).MonitorWith(FOmniEM).Run(@TMyOmniWorker.Execute);

Inside the Initialize function i make a checkup if the task is allowed to process:

  LFound := False;

  repeat
    // This will also receive the @TMyOmniWorker.Execute message!
    task.Comm.ReceiveWait(LMessage, 1000 * 5);

    LFound := (((LMessage.MsgID = MSG_CONTINUE_TASK) or (LMessage.MsgID = MSG_QUIT_TASK)) and (LMessage.MsgData[0].AsInt64 = task.UniqueID));

    /// START Execute Fix
    if not LFound then
      task.Comm.OtherEndpoint.Send(LMessage);

  until LFound;

Here the problem appears. It took some time to figure it out. The ReceiveWait function catches the Execute message and removes it from the internal list. In the end the Initialize function is finished, but the Execute procedure gets never called. Obviously this is really clear if you read this, but you have to know that the same message channel is used.

In order to "fix" the problem i receive the Execute message and send it again to the TMyOmniWorker/OtherEndpoint.

http://geskill.bplaced.net/hp/other/OmniWorkerTestwithMonitor.zip

best regards

Compiler warnings

What steps will reproduce the problem?
1. Compile OtlContainerObserver with Delphi 2009
or
1. Compile OtlComm with Delphi 2009

What is the expected output? What do you see instead?

[DCC Warning] OtlContainerObserver.pas(216): W1002 Symbol 'Win32Check' is 
specific to a platform

[DCC Warning] OtlComm.pas(662): W1002 Symbol 'Win32Check' is specific to a 
platform


What version of the product are you using? On what operating system?

* trunk / Windows

Please provide any additional information below.

* Can be removed with {$WARN SYMBOL_PLATFORM OFF}

Original issue reported on code.google.com by [email protected] on 8 Jun 2010 at 3:31

OmniQueue Dequeue problem

Sometimes (!) i have this problem happen when i use the TOmniQueue.IsEmpty function.

image

image

the object is created, but i dont why this error 'sometimes' happen. the function 'isempty' is called in a timer routine ('SetTimer').

function TAutechManager.StartAutech(pID: Integer; pIP: String; pPort: Word; pScanRate: Integer;
pExecuteMsg: Cardinal): IOmniTaskControl;
begin
FAutechWorker[pID] := TAutechWorker.Create(pIP, pPort);
FAutechTask[pID] := CreateTask(FAutechWorker[pID], pIP);
Result := FAutechTask[pID];
FAutechTask[pID].SetParameter('idx',pID);
FAutechTask[pID].SetParameter('ip',pIP);
FAutechTask[pID].SetParameter('scan_rate',pScanRate);
FAutechTask[pID].MonitorWith(EventMonitor);
//-- varredura da IHM (processar teclado e tela)
FAutechTask[pID].SetTimer(1, 10, pExecuteMsg);
FAutechTask[pID].Run;
end;

Thread pool stops working when a task is created while threads are being destroyed

There is this strange error i am encountering where omnithread stops scheduling tasks and just stops working...

Here is the code to reproduce the error i am having

Procedure PerformOperations(const task: IOmniTask);
Begin
Sleep(1000);
End;

procedure TForm1.Button1Click(Sender: TObject);
Var I: Integer;
begin
for I := 0 to 200 do
CreateTask(PerformOperations).
UnObserved.Schedule(ThreadPool);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ThreadPool := CreateThreadPool('ThreadPool');
ThreadPool.MaxExecuting := 60;
ThreadPool.MaxQueued := 0;
end;

When i click on the button it creates 200 tasks fine, but while looking at the thread count from task manager, as soon as the threads starts decreasing if i click on button1 that moment then thread count suddenly drops to 0 and after that no matter how many times i click on button1 for scheduling tasks no thread is created and no function is performed.

C++ Builder Errors in generated DSiWin32.hpp, OtlCommon.hpp, OtlSync.hpp

Files.zip

After building the Packages generating all C++ Files i get a number of error messages when trying to run a program.

typedef _WKSTA_INFO_100 *PWkstaInfo100; flags as an error E2257 , expected

then i get a bunch of E2040 Declaration terminated incorrectly for things like

static const System::Int8 CSIDL_ADMINTOOLS = System::Int8(0x30);
static const System::Int8 CSIDL_ALTSTARTUP = System::Int8(0x1d);
static const System::Int8 CSIDL_APPDATA = System::Int8(0x1a);
static const System::Int8 CSIDL_CDBURN_AREA = System::Int8(0x3b);

after all those i get errors in OtlCommon.hpp

E2238 Multiple declaration for 'TOmniValue::AsArrayItem' for the following

__property TOmniValue AsArrayItem[const System::UnicodeString name] = {read=GetAsArrayItem, write=SetAsArrayItem};
__property TOmniValue AsArrayItem[TOmniValue param] = {read=GetAsArrayItem, write=SetAsArrayItem};

and E2238 Multiple declaration for 'TOmniValueContainer::Item'

__property TOmniValue Item[const System::UnicodeString paramName] = {read=GetItem, write=SetItem};
__property TOmniValue Item[TOmniValue param] = {read=GetItem, write=SetItem};

in OtlSync.hpp i get the following
E2113 Virtual function '_fastcall IOmniCriticalSection::Release()' conflicts with base class 'IUnknown'
E2113 Virtual function '_fastcall IOmniResourceCount::Release()' conflicts with base class 'IUnknown'

currently i am getting round this by commenting out the lines in the hpp files

I've asked for assistance on stackover flow see link for details http://stackoverflow.com/questions/37775739/omnithreadlibrary-c-builder-build-issues/37777095?noredirect=1#comment63023683_37777095

i'm using C++ builder seattle and the latest OmniThreadLibrary form here i've attached my edited files

Does ReceiveWait unblock if task is terminated?

Owner calls ReceiveWait. Task never sends the message, but exits (maybe 
due to an exception). What happens in the owner?




Original issue reported on code.google.com by gabr42 on 25 Feb 2009 at 7:30

Designtime-files with wrong path in D2007

see the contents of OmniThreadLibrary-1.04b.zip
and the OmniThreadLibraryDesigntime files.

e.g. $(SystemRoot) isn't the right path to the following files:

<DCCReference Include="$(SystemRoot)\system32\rtl.dcp" />
<DCCReference Include="$(SystemRoot)\system32\vcl.dcp" />
<DCCReference Include="$(SystemRoot)\system32\vclx.dcp" />

Please correct the path.

<DCCReference Include="rtl.dcp" />
<DCCReference Include="vcl.dcp" />
<DCCReference Include="vclx.dcp" />

Original issue reported on code.google.com by [email protected] on 21 Dec 2009 at 1:39

Please release version 1.02 of this awesome library

I'm using OTL revision 270 in a project that uses around 4-5 threads.  And 
it works great!

I was about to use OTL in a new project with many more threads and noticed 
a lot of revisions/improvements in the OTL repository.

So I'm eagerly awaiting a new release of OTL that takes advantage of many 
improvements made after r270. The revisions after r270 look a bit complex 
(to me) so I hesitate to try them.

Thanks for OTL and keep up the great work!!!


Original issue reported on code.google.com by [email protected] on 1 Feb 2009 at 3:02

EJoinException should allow to "yank" inner exceptions

Currently, EJoinException allows to inspect the inner exceptions via Inner/Count properties. However, it would be nice to be able to yank/pop elements from Inner collection, in order to re-raise these in main thread. It is not possible currently as the exception would suffer double-free.

redesign thread pool

- Thread pools are not stable - there is some hard to find bug lurking.
- Thread pool should be based on a IOtlTaskControl.
- Reduce number of Windows messages used for pool control (to zero, if 
possible).

Original issue reported on code.google.com by gabr42 on 1 Nov 2008 at 3:12

Parallel.For hangs

The following minimal example compiles and runs fine with Delphi XE5 and OTL 3.04:

program test;
{$APPTYPE CONSOLE}
uses
  sysutils, otlparallel;
type
  EMyException = class(Exception);
begin
  try
    Parallel.Join(
      procedure
      begin
        WriteLn('Starting...');
        raise EMyException.Create('Error Message');
      end,
      procedure
      begin
        WriteLn('Starting...');
        raise EMyException.Create('Error Message');
      end).Execute;
  finally
    WriteLn('Done');
  end;
end.

It outputs, expectedly:

Starting...
Starting...
Done
Exception EJoinException in module test.exe at 00141E1A.
Error Message;
Error Message.

However, the following (equivalent) code hangs:

program test;
{$APPTYPE CONSOLE}
uses
  sysutils, otlparallel;
type
  EMyException = class(Exception);
begin
  try
    Parallel.For(0, 1).
      Execute(
        procedure(i: Integer)
        begin
          WriteLn('Starting...');
          raise EMyException.Create('Error Message');
        end);
  finally
    WriteLn('Done');
  end;
end.

Hash calculated in Add is not correct when Grow happens

What steps will reproduce the problem?
1. It always happens shCanGrow is executed in Add

What is the expected output? What do you see instead?
- The item hashed when shCanGrow is executed in Add cannot be found by the Find 
function.

What version of the product are you using? On what operating system?
- 1.05a, but I checked the latest source here at google and the problem is 
still there.

Please provide any additional information below.
- This is the fix: Simply move the hash calculation after the Grow, as below:

procedure TGpStringHash.Add(const key: string; value: integer);
var
bucket: PGpHashItem;
hash : cardinal;
begin
//  LK 27 June 2010: The following line was here, but if the Grow is
//  executed, then shNumBuckets gets changed and the hash used is wrong.
//  So the next line has to be moved after the Grow.
//hash := HashOf(key) mod shNumBuckets;
if shFirstEmpty > shSize then
if shCanGrow then
Grow
else
raise Exception.Create('TGpStringHash.Add: Maximum size reached');
//  LK 27 June 2010: Hash calculation moved here, and now it works.
hash := HashOf(key) mod shNumBuckets;


Original issue reported on code.google.com by [email protected] on 28 Jun 2010 at 5:00

Error installation on XE10.1 berlin

hello when i want to install omnithread 3.05 with GETIt i ve got an error when installting ( acces violation... )

is 10.1 Berlin compatible

Thanks
DAVID

task-wrapping TComponent

A TComponent that wraps IOmniTaskControl, allowing for simple background 
execution of one task.

Should have at least OnExecute, OnTerminate, OnMessage.

Original issue reported on code.google.com by gabr42 on 4 Nov 2008 at 6:46

IOmniBlockingCollection memory leak

Reported by marcin.repec, Jan 2, 2015

In case when collection has string or variant element data type, memory leaks occurs if collections is used as parameter in Parallel.ForEach.

Example to reproduce error:

var
  oct : IOmniBlockingCollection;
begin
  oct := TOmniBlockingCollection.Create();
  oct.Add('1234');
  oct.CompleteAdding;
  Parallel.ForEach(oct).Execute(
              procedure(const value: TOmniValue)
              begin
              end
    );
  oct := nil;
end;

FastMM reports line oct.Add('1234') as source line, and TOmniStringData, UnicodeString as class associated with leak.

Curious thing is that there is no leak when :

  • collection has simple type (f.e. integer) and ForEach is called
  • ForEach is not called

xe2, otl from svn trunk

Missing OmniThreadLibraryRuntimeXE7.dcp

Reported by hansvanmoosel, Mar 18, 2015

Working with Delphi XE7,
On opening the OmniThreadLibraryPackagesXE7.groupproj and then compile it it is generating the error OmniThreadLibraryRuntimeXE7.dcp missing.
Compiled the OmniThreadLibraryRuntimeXE7.bpl Ok.
Compiled the OmniThreadLibraryDesigntimeXE7.bpl Error OmniThreadLibraryRuntimeXE7.dcp missing.

Abstract Error

procedure TForm1.FormCreate(Sender: TObject);
var
LLoop: IOmniParallelLoop;
LInput: IOmniBlockingCollection;
LOutput: IOmniBlockingCollection;
begin
LInput := TOmniBlockingCollection.Create;
LOutput := TOmniBlockingCollection.Create;

LLoop := Parallel.ForEach(LInput);
LLoop.PreserveOrder
.NoWait
.Into(LOutput)
.Execute(procedure (const value: TOmniValue; var res: TOmniValue) begin res := value end);
end;

It is not possible to perserve the order (.Into), when the input is TOmniBlockingCollection.

Please update included FastMM 4.90 to 4.92

FastMM 4.90 is bundled with OTL 1.03.

Please consider updating to FastMM 4.92 to benefit from bugfixes and 
enhancements.

Thanks so much for providing this fantastic library!

ps

The frequent releases are great!  It makes it less scary for us mortals to 
upgrade OTL.


Original issue reported on code.google.com by [email protected] on 9 Feb 2009 at 12:12

Request: Simple practical tutorial

Could somebody write a simple tutorial on how to properly execute a task in the background, without blocking the UI? I'm not talking about parallel executions, but how to have a procedure to be executed (and being able to get canceled) in its own thread just for the purpose of not blocking (completely) the UI.

Some messaging is good, but I don't want to get bogged down with the details. The current examples are either "hello world" or some incomprehensible, complex thing with many blocking collections, with no example in between.

I'm struggling, badly, with this. Things get either executed many times (even if I put "NumTasks(1)") or the program get frozen.

WWW oldies

when I google for omnithreadlibrary then google sends me to http://otl.17slon.com/

there left-side "Download" link leads to http://otl.17slon.com/download.htm

and that page still suggests to learn Subversion and go to Google Code

since that is one of the most probably pages to download OTL via (it is top google result), I suggest it was reworked to point at GitHub and Git-for-Windows/TortoiseGit project instead

Unable to compile test apps in Delphi 2010 / Windows Vista 32-bit

I've downloaded the latest version of OTL (SVN on 31 May 2011) and cannot 
compile the hello world test on Delphi 2010, on Windows Vista 32 bit.  I manage 
to compile the 2010 design and runtime projects and can install the design-time 
BPL but cannot compile the test application.

[DCC Fatal Error] app_1_HelloWorld.dpr(20): F2051 Unit SysUtils was compiled 
with a different version of Windows.MakeWord

The unit it stops in is not an OTL unit but a Delphi one:
c:\program files\embarcadero\rad studio\7.0\source\Win32\rtl\win\UxTheme.pas.

It stops at the uses clause on the SyncObjs unit inside UxTheme.pas.

I went as far as doing a 'repair' install of my Delphi install but that didn't 
make a difference.

Any tips would be greatly appreciated.  

Original issue reported on code.google.com by [email protected] on 31 May 2011 at 11:27

AV in pipeline demo

Hi,

I consistently get an access violation in the HL-III pipeline demo (This is the web spider demo). (http://www.omnithreadlibrary.com/webinars/code/HL-III.zip)

I'm not sure if this is due to a bug in OTL or perhaps in the code in the demo.

How to reproduce:
I make 1 simple change to the demo. In the method TfrmWebSpider.ExtractLinks:

for url in parser.Parsed.Hyperlinks do
  //if not StartsText('http', url) then
  begin
    FURLCount.Increment;
    FSpider.Input.TryAdd(url);
  end;

I comment out the "if" statement. So now the demo will go for all links. If run this way the program will download a total of 90 links in a short time.

I press start, then after about 10 entries have been added I press "Stop". The program waits and then comes up with an AV.

I'm using DXE4, Win 7 x64

Wish: TOmniBlockingCollection.ToArray cuold flatten arrays

I wish ToArray could flatten nested arrays of some value type.

So the program below would work with StringList-oriented approach.

Why ? So ForEach.Into(xxx) delegate workers would be able to post several values in the procedure call, packing them into TOmniValue.

program Project6;
{$APPTYPE CONSOLE}

uses
  OtlCollections, Classes, OtlCommon,
  System.SysUtils, Types;

var
  Data: iOmniBlockingCollection;

  procedure Dump1(const a1, a2: Integer);
  var i: integer; sl: TStrings;
  begin
    sl := TStringList.Create;
    try
      for i := a1 to a2 do
        sl.Add(IntToStr(i));

      Data.Add( TOmniValue.FromArray<string>( sl.ToStringArray ) );
    finally
      sl.Destroy;
    end;
  end;

  procedure Dump2(const a1, a2: Integer);
  var i: integer;
  begin
    for i := a1 to a2 do
      Data.Add( TOmniValue( IntToStr( i ) ) );
  end;

var
  sa: TStringDynArray;
  i: integer;

begin
  try
    { TODO -oUser -cConsole Main : Insert code here }
    Data := TOmniBlockingCollection.Create();

//    Dump1( 100, 120 );
//    Dump1( 200, 220 );
//    Dump1( 300, 320 );

    Dump2( 100, 120 );
    Dump2( 200, 220 );
    Dump2( 300, 320 );

    //  put Dump1 here instead of Dump2 - and it chokes at ToArray line

    Data.CompleteAdding;

    sa := TStringDynArray( TOmniBlockingCollection.ToArray<string>( Data ) );

    for i := Low(sa) to High(sa) do
      Writeln( i:3, ' : ', sa[i]);
    Writeln;
    Writeln(Length(sa));
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;

  write('Finished, press Enter');
  Readln;
end.

Passing a object as param

What steps will reproduce the problem?
1. Pass any TComponent descendent using SetParameter in CreateTask;
2. Try to get the value inside the thread using Param or ParamByName;
3. Its raize a access violation exception;

What is the expected output? What do you see instead?
- a object instance;

What version of the product are you using? On what operating system?
- the last one;

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Nov 2008 at 11:40

Installing OTL in DX Seattle afflicts OTL in DXE8

Although both packages are installed in different directories:

Delphi XE8: F:\Users\Documents\Embarcadero\Studio\16.0\CatalogRepository\OmniThreadLibrary-3.04b

Delphi X Seattle: F:\Users\Documents\Embarcadero\Studio\17.0\CatalogRepository\OmniThreadLibrary-3.04b

After having installed OTL in Delphi X Seattle with the GetIt package manager, when starting Delphi XE8 the following error message is displayed:


[Window Title]
Error
[Content]
Can't load package C:\Users\Public\Documents\Embarcadero\Studio\16.0\bpl\OmniThreadLibraryDesigntimeXE8.bpl.
Access violation at address 32E08791 in module 'bds.exe'. Read of address 00000010.
Do you want to attempt to load this package the next time a project is loaded?

[Yes] [No]

So it seems that OTL Seattle afflicts OTL XE8. Why? This should not be the case.

Memory leaks when canceling a connection pool with tasks in queue

What steps will reproduce the problem?
1. open app_24_ConnectionPool
2. before Application.Initialize; insert ReportMemoryLeaksOnShutdown := True;
3. run programm and click four times on Schedule then click on close box

What is the expected output? What do you see instead?
* should not report memory leaks
* reports several memory leaks, depending on task count


What version of the product are you using? On what operating system?
* trunk / windows

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 8 Jun 2010 at 3:35

Feature Request: De-throttling for pipelines and/or collections.

Making a demo got an app frozen at Pipeline.WaitFor

After a while I figured out the reason.
And I agree that for server0like application when first results should be yielded to client before the last item produced it makes little use.

Still I think that potentially blocking features should be made optional, at least on bailout terms.

So I ask for one of (or both) features:

  1. iOmniPipeline.DeThrottle() procedure with the same use semantics as per .Throttle
  2. iOmniBlockingCollection expanded with .WasAccessed function and .DeThrottle procedure so pipeline stages could do

if not output.WasAccessed() then output.DeThrottle()

This feature would perhaps be even more useful for self-re-fuelling pipelines when the same stage can be both producer and consumer, thus blocking itself on TryAdd would prevent further TryTake and cause self-deadlock..

Perhaps IOmniBlockingCollection.IsThrottlingEnabled() and IOmniBlockingCollection.IsThrottlingNow() might be of use too. So if a pipeline stage requires not-throttled collection and can no more change its mode it can explicitly raise exception

Method Invoke with Taskgroup seems not to work

I have a OmniTaskGroup with some OmniTaskControl. I want to use the invoke method to notify my tasks:

for oMyTask in oMyTaskGroup.Tasks do
  oMyTask.Invoke('MyMethod', oMyObjectParameter);

Not worked...

I also tried:

oMyTaskGroup.SendToAll(TOmniInternalStringMsg.CreateMessage('MyMethod', oMyObjectParameter));

Not have the expected result

Am I doing something wrong?

Crash in TOmniTask.Execute in ConnectionPool example

What steps will reproduce the problem?
1. Open test_24_ConnectionPool in Delphi 2009 Update 1
2. Run the app in debug mode
3. Press the "Schedule" button and wait a couple of seconds

What is the expected output? What do you see instead?

A crash happen in OtlTaskControl.pas at line 833 (otSharedInfo.ChainTo.Run;
// TODO 1 -oPrimoz Gabrijelcic : Should execute the chained task in the
same thread (should work when run in a pool))

What version of the product are you using? On what operating system?

OmniThread Version 1.03 on Delphi 2009 Update 1 Windows XP SP3

Please provide any additional information below.

I get the same problem with the 11_ThreadPool example

Original issue reported on code.google.com by [email protected] on 6 Apr 2009 at 1:48

app_15_TaskGroup.exe : Access violation if all threads are stopped

What steps will reproduce the problem?
1. Start app_15_TaskGroup.exe
2. Press 'stop tasks'

What is the expected output? What do you see instead?

Expected: 'All stopped'.

Instead: Access violation at address 0048D7C4 in module 
'app_15_TaskGroup.exe'. Read of address 00000000.



What version of the product are you using? On what operating system?
v1.03: 2009-02-08

Please provide any additional information below.
Checking if FTaskGroup is assigned fixes the problem.

procedure TfrmTestTaskGroup.btnStopTasksClick(Sender: TObject);
begin
  if Assigned(FTaskGroup) then
  begin
    FTaskGroup.TerminateAll;
    FTaskGroup := nil;
    Log('All stopped');
  end
  else
    Log('Nothing to stop');
end;

Original issue reported on code.google.com by [email protected] on 5 Oct 2009 at 6:01

app_19_StringMsgBenchmark : access violation if FastMM4 is used

What steps will reproduce the problem?
1. Start app_19_StringMsgBenchmark from the IDE


What is the expected output? What do you see instead?
Expected the application to start. 

Instead, the application immediately jumps to the first 'begin' in 
app_19_StringMsgBenchmark.dpr.

After pressing F9 to continue execution, an access violation is thrown:

---------------------------
Debugger Fault Notification
---------------------------
app_19_StringMsgBenchmark.exe faulted with message: 'access violation at 
0x7c92abd5: write of address 0x00030d24'. Process Stopped. Use Step or Run 
to continue.


What version of the product are you using? On what operating system?
* OmniThread v1.03: 2009-02-08
* Delphi 2009 (without any service packs)
* 32bits Windows XP pro SP3, English on an i7 processor.
* Fast Memory Manager 4.92 (exactly same one as the one in the OmniThread 
svn repository.. did a diff to confirm)

Please provide any additional information below.

Removing FastMM4 gets rid of this issue, and everything runs fine.
It's odd, because I'm using FastMM4 in many other applications without 
problems.  I've tried to add FastMM4 (as the first unit in the .dpr) to the 
other examples, and that resulted in the same type of crash.

Could there be a conflict between FastMM4 and the OmniThread library?

Original issue reported on code.google.com by [email protected] on 5 Oct 2009 at 6:17

CreateTask in Task group with Unobserved function call fails

Reported by Saskathex, Nov 11, 2014

Following code produces on certain machines an error. The error happens sometimes but not all the times.

TaskGroup := CreateTaskGroup;
try
  for I := 0 to 2 do
    CreateTask (TestTask, Format ('TestTask %d', [I]))
      .SetParameter ('Number', I)
      .Unbserved
      .Join (TaskGroup);

  TaskGroup.RunAll;

Starting the tasks inside the Task Group Fails with the following stack trace:

OtlEventMonitor:221 (OtlEventMonitor.TOmniEventMonitor.Destroy) Access violation at address 0000000002060A36 in module 'ABC.exe'. Read of address 0000000000000000
[0000000002060A36] OtlEventMonitor.TOmniEventMonitor.Destroy (Line 221, "OtlEventMonitor.pas")
[0000000076D21278] KiUserExceptionDispatcher
[0000000002060A36] OtlEventMonitor.TOmniEventMonitor.Destroy (Line 221, "OtlEventMonitor.pas")
[000000000205E2DF] OtlTaskControl.TOmniTaskControlEventMonitor.Create (Line 3348, "OtlTaskControl.pas")
[0000000002061BE6] OtlEventMonitor.TOmniEventMonitorPool.Allocate (Line 414, "OtlEventMonitor.pas")
[000000000205E55D] OtlTaskControl.TOmniTaskControlEventMonitorPool.Allocate (Line 3379, "OtlTaskControl.pas")
[000000000205A114] OtlTaskControl.TOmniTaskControl.CreateInternalMonitor (Line 2491, "OtlTaskControl.pas")
[000000000205CD54] OtlTaskControl.TOmniTaskControl.Unobserved (Line 3045, "OtlTaskControl.pas")

Using Version 3.03b on an Windows Server 2008R2 64bit.

Removing the Unobserved function call works for us!

Thread-safety issue in TOmniCriticalSection.LockCount

In TOmniCriticalSection.Release, ocsLockCount is decreased AFTER ocsCritSect.Release. This should be done BEFORE, to prevent a concurrency-issue when a thread-switch leads to a conflicting increment of ocsLockCount in TOmniCriticalSection.Acquire.

Big memory leak (consumption) on pipeline running from another thread

Hello.

If you run pipeline from another thread you got big memory leak at runtime (but it will free on application close).

Here example. Click button 10 times and test app will get ~600 MB of memory. Windows 7 x64, Delphi XE6, latest omni source.

uses
  OtlParallel,
  OtlCommon;

procedure TForm75.Button1Click(Sender: TObject);
begin
  // run empty pipeline from another threads
  Parallel.&For(1, 100).Execute(
    procedure(value: integer)
    var
      pipe: IOmniPipeline;
    begin
      pipe := Parallel.Pipeline
        .Stage(procedure(const input: TOmniValue; var output: TOmniValue) begin end)
        .Run;
      pipe.Cancel;
      pipe.WaitFor(100000);
      pipe := nil;
    end
  );
end;

Error TOmniCommunicationEndpoint.Send: Queue is full or Code: 1816. Not enough quota

Hello.

I have multi-threads application. Some tasks working at background and produce many logs. Also it wait income commands from main thread.

Main thread process messages by TOmniEventMonitor.OnTaskMessage. Background tasks send messages by IOmniTask.Comm.Send.

It's work fine with small batch of logs. But then main thread is freeze or can't process all logs, message queues from background tasks is overflow and task will end up with error "TOmniCommunicationEndpoint.Send: Queue is full".

I try to SetQueueSize(10000), but then Windows raise error: "Code: 1816. Not enough quota".

Can I check queue status and wait until queue is not full? Or I need to use another architecture?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.