updateHook called before startHook !!!

Hello orocos-devs.

I'am working on the git master branch of the 9th november.

While i'm tracking why my nonperiodic task don't start automatically, i have found a very strange bug !

The updateHook seems to be called before the startHook. I join the archive that allow me to reproduce the bug (i have to launch the test several times, it depend on the timing).

I suggest an error in the rtt source code. One one hand, in ExecutionEngine.cpp at line 317 in the function processChildren, we check (taskc->mTargetState == TaskCore::Running). On the other hand, in TaskCore.cpp at line 177 in the function start, we set (mTargetState = Running) before calling startHook(). So i think we can have the case where updateHook, is called before startHook.

Am i misunderstood something ?

Thank you for your reading.

Paul.

AttachmentSize
bug_update_before_start.tar_.bz21.23 KB

updateHook called before startHook !!!

On Friday 12 November 2010 14:55:08 paul [dot] chavent [..] ... wrote:
> Hello orocos-devs.
>
> I'am working on the git master branch of the 9th november.
>
> While i'm tracking why my nonperiodic task don't start automatically, i
> have found a very strange bug !
>
> The updateHook seems to be called before the startHook. I join the archive
> that allow me to reproduce the bug (i have to launch the test several
> times, it depend on the timing).
>
> I suggest an error in the rtt source code.
> One one hand, in ExecutionEngine.cpp at line 317 in the function
> processChildren, we check (taskc->mTargetState == TaskCore::Running). On
> the other hand, in TaskCore.cpp at line 177 in the function start, we set
> (mTargetState = Running) before calling startHook(). So i think we can
> have the case where updateHook, is called before startHook.
>
> Am i misunderstood something ?

Your analysis was correct. This bug has been fixed on the master branch. The fix
fixes your both reports: too early calling of updateHook() and/or the not
calling of updateHook() after a start().

BTW: Calling 'trigger()' in startHook() will not work, since trigger() only
works when getTaskState() returns 'Running', which it will only do when
startHook() returns true. The RTT calls trigger() itself after startHook()
returns true in order to solve this dependency problem.

Peter

updateHook called before startHook !!!

Hello again.

I think there is also a problem for starting a non-periodic Task.

When we call start() on a TaskContext, i can't find any function that allow to signal the semaphore that wait at line ~116 of Thread.cpp.

In the 1.x there was a call to engine->start() and i suppose that was the magic that start the thread->loop.

Is there any new recommendation on the use of aperiodic tasks ? Should the deployer call trigger for autostarted components ?

In the latter case, would you like i suggest a patch for ocl ?

I must admit that i haven't read the whole documentation yet, and i'm not aware of all the new usage of 2.X.

Thank you.

Paul.

paul [dot] chavent [..] ... wrote:
> Hello orocos-devs.
>
> I'am working on the git master branch of the 9th november.
>
> While i'm tracking why my nonperiodic task don't start automatically, i
> have found a very strange bug !
>
> The updateHook seems to be called before the startHook. I join the
> archive that allow me to reproduce the bug (i have to launch the test
> several times, it depend on the timing).
>
> I suggest an error in the rtt source code. One one hand, in
> ExecutionEngine.cpp at line 317 in the function processChildren, we
> check (taskc->mTargetState == TaskCore::Running).
> On the other hand, in TaskCore.cpp at line 177 in the function start, we
> set (mTargetState = Running) before calling startHook().
> So i think we can have the case where updateHook, is called before
> startHook.
>
> Am i misunderstood something ?
>
> Thank you for your reading.
>
> Paul.
>
>
>

updateHook called before startHook !!!

On Friday 12 November 2010 19:35:19 Paul Chavent wrote:
> Hello again.
>
> I think there is also a problem for starting a non-periodic Task.
>
> When we call start() on a TaskContext, i can't find any function that allow
> to signal the semaphore that wait at line ~116 of Thread.cpp.
>
> In the 1.x there was a call to engine->start() and i suppose that was the
> magic that start the thread->loop.
>
> Is there any new recommendation on the use of aperiodic tasks ? Should the
> deployer call trigger for autostarted components ?

This is not the intention. Are you referring to the fact that after start()
updateHook() was not called ? That has been fixed on the master branch. I can't
backport it to 2.1 since it contains ABI-incompatible updates.

>
> In the latter case, would you like i suggest a patch for ocl ?

No.

>
>
> I must admit that i haven't read the whole documentation yet, and i'm not
> aware of all the new usage of 2.X.

It was a bug. It should behave as 1.x.

Peter

updateHook called before startHook !!!

Hello orocos-devs.

I'am working on the git master branch of the 9th november.

While i'm tracking why my nonperiodic task don't start automatically, i have found a very strange bug !

The updateHook seems to be called before the startHook. I join the archive that allow me to reproduce the bug (i have to launch the test several times, it depend on the timing).

I suggest an error in the rtt source code.
One one hand, in ExecutionEngine.cpp at line 317 in the function processChildren, we check (taskc->mTargetState == TaskCore::Running).
On the other hand, in TaskCore.cpp at line 177 in the function start, we set (mTargetState = Running) before calling startHook().
So i think we can have the case where updateHook, is called before startHook.

Am i misunderstood something ?

Thank you for your reading.

Paul.