revalNG / omnithreadlibrary

Automatically exported from code.google.com/p/omnithreadlibrary
0 stars 0 forks source link

Crash in TOmniTask.Execute in ConnectionPool example #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 simonale...@gmail.com on 6 Apr 2009 at 1:48

GoogleCodeExporter commented 8 years ago
I can confirm this behaviour, using XP on a single-processor machine.

The problem seems to be that posting COmniTaskMsg_Terminated to the 
MonitorWindow
triggers the detaching of the IOmniTaskControl interface from the monitored 
tasks
list, and if there is no other reference to the interface the ref count drops 
to zero
and the task control object is being destroyed, even though TOmniTask.Execute() 
is
still executing in the other thread. Any subsequent accessing of otSharedInfo 
leads
to the crash.

As a quick check I changed TOmniSharedTaskInfo to be a record instead of a 
class, so
it gets deep-copied in TOmniTask.Create(), and then the crash does no longer 
happen.

Original comment by michael....@gmail.com on 23 Jul 2009 at 6:19

GoogleCodeExporter commented 8 years ago
Fixed post 1.04 alpha (in revision 456).

Original comment by gabr42 on 13 Nov 2009 at 7:34