Changing the behaviour of updateHook()

To all,

This title that late at night, I'm sure I got your attention!

It's serious though. We have observed lately two major issues:

1. updateHook() is called *too many times* (even according to
specifications), especially when 'OwnThread' operations are implemented OR
called(!).
-> This was due to internal bookkeeping of the ExecutionEngine to dispatch
the asynchronous requests. Users found it confusing that updateHook was
called during the use of operations. This also kills performance of Lua
state machines
sitting in updateHook(), since they are evaluated too many times.

2. Installing a callback for an event port caused calling that callback AND
updateHook(), instead of calling only the callback.
-> The callback does not replace the call to updateHook(). This is also
related to users being surprised that an event port callback is only called
periodically in periodic threads, while they thought it would be called
immediately upon each event reception, and eventually updateHook
periodically (but serialized with the callbacks).

The idea then rose to have updateHook() to only be called after:
1) any call to TaskContext::trigger()
-> for activities which allow this user control
2) the component's activity triggered itself (periodic, file descriptor,
...)
-> what users expect
3) the component is being update()
-> for slave activity behavior

I have some unfinished patches in my queue that try to prove this works,
but maybe now is already a good time for feedback (just before I go on
holidays :-). I think fixing 1) is actually fixing applications instead of
breaking them. 2) causes more subtle changes... what do you think ?

Peter

Changing the behaviour of updateHook()

Hi all,

On 04/04/2012 00:45, Peter Soetens wrote:
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented
> OR called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to
> dispatch the asynchronous requests. Users found it confusing that
> updateHook was called during the use of operations. This also kills
> performance of Lua state machines
> sitting in updateHook(), since they are evaluated too many times.

I'm very glad to see this proposition.

We are heavily relying both on operations for asynchronous
communications and the updateHook() calls to manage the simulation
timesteps, so these problems are well known in our team.

I must confess we did not have time back then to submit these issues you
mentioned to orocos-dev@ (schedule constraints), so we used a (kind of)
workaround: an updateHook() "manager", to "cluch" and "decluch" the
updateHook() calls according to the situations.

So, count a +1 for all our team members (make it a +15).

Changing the behaviour of updateHook()

On Apr 3, 2012, at 18:45 , Peter Soetens wrote:

> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to specifications), especially when 'OwnThread' operations are implemented OR called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch the asynchronous requests. Users found it confusing that updateHook was called during the use of operations. This also kills performance of Lua state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback AND updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also related to users being surprised that an event port callback is only called periodically in periodic threads, while they thought it would be called immediately upon each event reception, and eventually updateHook periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control

RTT v1 does this also, and causes additional updateHook() as commands and events call this. RTT shouldn't do this IMHO. It should only call updateHook() in the two cases below i.e. events/commands (yes, the RTT v2 Operation equivalent) should not be trigger'ing extra updateHook's.

> 2) the component's activity triggered itself (periodic, file descriptor, ...)
> -> what users expect

+1

> 3) the component is being update()
> -> for slave activity behavior

+1

> I have some unfinished patches in my queue that try to prove this works, but maybe now is already a good time for feedback (just before I go on holidays :-). I think fixing 1) is actually fixing applications instead of breaking them. 2) causes more subtle changes... what do you think ?

Agreed. This is fixing applications by removing extraneous "features" within RTT ...
S

Ruben Smits's picture

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 12:45 AM, Peter Soetens <peter [..] ...>wrote:

> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback
> AND updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
> I have some unfinished patches in my queue that try to prove this works,
> but maybe now is already a good time for feedback (just before I go on
> holidays :-). I think fixing 1) is actually fixing applications instead of
> breaking them. 2) causes more subtle changes... what do you think ?
>

+1

It could explain a lot of weirdness that I have with my applications.

Ruben

>
> Peter
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>

Changing the behaviour of updateHook()

On 04/04/2012 12:45 AM, Peter Soetens wrote:
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior

+1

I would also vote for *not* calling updateHook just after startHook.
This is the current behaviour as well, and does not make any sense to me
(since the updateHook was never triggered).

Changing the behaviour of updateHook()

On Apr 4, 2012, at 04:24 , Sylvain Joyeux wrote:

> On 04/04/2012 12:45 AM, Peter Soetens wrote:
>> The idea then rose to have updateHook() to only be called after:
>> 1) any call to TaskContext::trigger()
>> -> for activities which allow this user control
>> 2) the component's activity triggered itself (periodic, file descriptor,
>> ...)
>> -> what users expect
>> 3) the component is being update()
>> -> for slave activity behavior
>
> +1
>
> I would also vote for *not* calling updateHook just after startHook.
> This is the current behaviour as well, and does not make any sense to me
> (since the updateHook was never triggered).

This seems reasonable, but also likely to break existing systems.
S

Changing the behaviour of updateHook()

2012/4/4 S Roderick <kiwi [dot] net [..] ...>:
> On Apr 4, 2012, at 04:24 , Sylvain Joyeux wrote:
>
>> On 04/04/2012 12:45 AM, Peter Soetens wrote:
>>> The idea then rose to have updateHook() to only be called after:
>>> 1) any call to TaskContext::trigger()
>>> -> for activities which allow this user control
>>> 2) the component's activity triggered itself (periodic, file descriptor,
>>> ...)
>>> -> what users expect
>>> 3) the component is being update()
>>> -> for slave activity behavior
>>
>> +1
>>
>> I would also vote for *not* calling updateHook just after startHook.
>> This is the current behaviour as well, and does not make any sense to me
>> (since the updateHook was never triggered).
>
> This seems reasonable, but also likely to break existing systems.
> S
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

FYI I used to schedule chains of dataflow processing with eventPort.
Basically I have always one input port and one output port by
component and there are all in a computation chain. So using an
eventPort on the input allowed me schedule all this without having to
code an external scheduler. It's maybe a bad practise but ase there is
no pre-coded schedulor in OCL it always saved time ^^

Changing the behaviour of updateHook()

2012/4/4 Willy Lambert <lambert [dot] willy [..] ...>

> 2012/4/4 S Roderick <kiwi [dot] net [..] ...>:
> > On Apr 4, 2012, at 04:24 , Sylvain Joyeux wrote:
> >
> >> On 04/04/2012 12:45 AM, Peter Soetens wrote:
> >>> The idea then rose to have updateHook() to only be called after:
> >>> 1) any call to TaskContext::trigger()
> >>> -> for activities which allow this user control
> >>> 2) the component's activity triggered itself (periodic, file
> descriptor,
> >>> ...)
> >>> -> what users expect
> >>> 3) the component is being update()
> >>> -> for slave activity behavior
> >>
> >> +1
> >>
> >> I would also vote for *not* calling updateHook just after startHook.
> >> This is the current behaviour as well, and does not make any sense to me
> >> (since the updateHook was never triggered).
> >
> > This seems reasonable, but also likely to break existing systems.
> > S
> >
> > --
> > Orocos-Dev mailing list
> > Orocos-Dev [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
> FYI I used to schedule chains of dataflow processing with eventPort.
> Basically I have always one input port and one output port by
> component and there are all in a computation chain. So using an
> eventPort on the input allowed me schedule all this without having to
> code an external scheduler. It's maybe a bad practise but ase there is
> no pre-coded schedulor in OCL it always saved time ^^
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>

I guess most of the people relying on event-port triggering to launch their
component and execute updateHook usually do not attach a specific callback
to their event port...
Hence in that case it should still work after Peter's modifications.

Charles.

Changing the behaviour of updateHook()

2012/4/4 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>:
>
>
> 2012/4/4 Willy Lambert <lambert [dot] willy [..] ...>
>>
>> 2012/4/4 S Roderick <kiwi [dot] net [..] ...>:
>> > On Apr 4, 2012, at 04:24 , Sylvain Joyeux wrote:
>> >
>> >> On 04/04/2012 12:45 AM, Peter Soetens wrote:
>> >>> The idea then rose to have updateHook() to only be called after:
>> >>> 1) any call to TaskContext::trigger()
>> >>> -> for activities which allow this user control
>> >>> 2) the component's activity triggered itself (periodic, file
>> >>> descriptor,
>> >>> ...)
>> >>> -> what users expect
>> >>> 3) the component is being update()
>> >>> -> for slave activity behavior
>> >>
>> >> +1
>> >>
>> >> I would also vote for *not* calling updateHook just after startHook.
>> >> This is the current behaviour as well, and does not make any sense to
>> >> me
>> >> (since the updateHook was never triggered).
>> >
>> > This seems reasonable, but also likely to break existing systems.
>> > S
>> >
>> > --
>> > Orocos-Dev mailing list
>> > Orocos-Dev [..] ...
>> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>>
>> FYI I used to schedule chains of dataflow processing with eventPort.
>> Basically I have always one input port and one output port by
>> component and there are all in a computation chain. So using an
>> eventPort on the input allowed me schedule all this without having to
>> code an external scheduler. It's maybe a bad practise but ase there is
>> no pre-coded schedulor in OCL it always saved time ^^

I'm also using this event-driven dataflow in my application, but I
most of the time attach a custom callback function to the event port,
as a lot of components have multiple event ports and I need different
things to happen depending on which port is updated. Using custom
callbacks makes this very clear as to what happens when.

>> --
>> Orocos-Dev mailing list
>> Orocos-Dev [..] ...
>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>
> I guess most of the people relying on event-port triggering to launch their
> component and execute updateHook usually do not attach a specific callback
> to their event port...
> Hence in that case it should still work after Peter's modifications.

I have some cases in which the updateHook method is just empty, and
only custom callbacks are implemented. But even with code in the
updateHook, I don't mind to trigger it myself in the callback, it
would actually make the code more readable.

Steven

>
> Charles.
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 10:24 AM, Sylvain Joyeux <sylvain [dot] joyeux [..] ...> wrote:
> On 04/04/2012 12:45 AM, Peter Soetens wrote:
>>
>> The idea then rose to have updateHook() to only be called after:
>> 1) any call to TaskContext::trigger()
>> -> for activities which allow this user control
>> 2) the component's activity triggered itself (periodic, file descriptor,
>> ...)
>> -> what users expect
>> 3) the component is being update()
>> -> for slave activity behavior
>
>
> +1
>
> I would also vote for *not* calling updateHook just after startHook. This is
> the current behaviour as well, and does not make any sense to me (since the
> updateHook was never triggered).

Hmm. I think it was a mailing list discussion that led to this
behavior...at least we discussed this before. I'll have to look up
what was the reasoning back then.

Peter

Ruben Smits's picture

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 10:24 AM, Sylvain Joyeux <sylvain [dot] joyeux [..] ...>wrote:

> On 04/04/2012 12:45 AM, Peter Soetens wrote:
> > The idea then rose to have updateHook() to only be called after:
> > 1) any call to TaskContext::trigger()
> > -> for activities which allow this user control
> > 2) the component's activity triggered itself (periodic, file descriptor,
> > ...)
> > -> what users expect
> > 3) the component is being update()
> > -> for slave activity behavior
>
> +1
>
> I would also vote for *not* calling updateHook just after startHook.
> This is the current behaviour as well, and does not make any sense to me
> (since the updateHook was never triggered).
>
>
+1, if it is needed the user can add a call or send to update manually in
it's starthook, it at least makes the desired behaviour explicit.

Ruben

> --
> Sylvain Joyeux (Dr.Ing.)
> Space & Security Robotics
>
> !!! Achtung, neue Telefonnummer!!!
>
> Standort Bremen:
> DFKI GmbH
> Robotics Innovation Center
> Robert-Hooke-Straße 5
> 28359 Bremen, Germany
>
> Phone: +49 (0)421 178-454136
> Fax: +49 (0)421 218-454150
> E-Mail: robotik [..] ...
>
> Weitere Informationen: http://www.dfki.de/robotik
> -----------------------------------------------------------------------
> Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
> Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
> Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
> (Vorsitzender) Dr. Walter Olthoff
> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
> Amtsgericht Kaiserslautern, HRB 2313
> Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
> USt-Id.Nr.: DE 148646973
> Steuernummer: 19/673/0060/3
> -----------------------------------------------------------------------
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>

Changing the behaviour of updateHook()

On Wednesday 04 April 2012 10:57:09 Ruben Smits wrote:
> On Wed, Apr 4, 2012 at 10:24 AM, Sylvain Joyeux
<sylvain [dot] joyeux [..] ...>wrote:
> > On 04/04/2012 12:45 AM, Peter Soetens wrote:
> > > The idea then rose to have updateHook() to only be called after:
> > > 1) any call to TaskContext::trigger()
> > > -> for activities which allow this user control
> > > 2) the component's activity triggered itself (periodic, file
> > > descriptor, ...)
> > > -> what users expect
> > > 3) the component is being update()
> > > -> for slave activity behavior
> >
> > +1
> >
> > I would also vote for *not* calling updateHook just after startHook.
> > This is the current behaviour as well, and does not make any sense to me
> > (since the updateHook was never triggered).
>
> +1, if it is needed the user can add a call or send to update manually in
> it's starthook, it at least makes the desired behaviour explicit.
+1
>
> Ruben
>
> > --
> > Sylvain Joyeux (Dr.Ing.)
> > Space & Security Robotics
> >
> > !!! Achtung, neue Telefonnummer!!!
> >
> > Standort Bremen:
> > DFKI GmbH
> > Robotics Innovation Center
> > Robert-Hooke-Straße 5
> > 28359 Bremen, Germany
> >
> > Phone: +49 (0)421 178-454136
> > Fax: +49 (0)421 218-454150
> > E-Mail: robotik [..] ...
> >
> > Weitere Informationen: http://www.dfki.de/robotik
> > -----------------------------------------------------------------------
> > Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
> > Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
> > Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
> > (Vorsitzender) Dr. Walter Olthoff
> > Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
> > Amtsgericht Kaiserslautern, HRB 2313
> > Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
> > USt-Id.Nr.: DE 148646973
> > Steuernummer: 19/673/0060/3
> > -----------------------------------------------------------------------
> > --
> > Orocos-Dev mailing list
> > Orocos-Dev [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

Changing the behaviour of updateHook()

On Wed, Apr 04, 2012 at 10:24:22AM +0200, Sylvain Joyeux wrote:
> On 04/04/2012 12:45 AM, Peter Soetens wrote:
> > The idea then rose to have updateHook() to only be called after:
> > 1) any call to TaskContext::trigger()
> > -> for activities which allow this user control
> > 2) the component's activity triggered itself (periodic, file descriptor,
> > ...)
> > -> what users expect
> > 3) the component is being update()
> > -> for slave activity behavior
>
> +1
>
> I would also vote for *not* calling updateHook just after startHook.
> This is the current behaviour as well, and does not make any sense to me
> (since the updateHook was never triggered).

+1
Markus

Changing the behaviour of updateHook()

On 04/04/2012 12:45 AM, Peter Soetens wrote:
> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are
> implemented OR called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to
> dispatch the asynchronous requests. Users found it confusing that
> updateHook was called during the use of operations. This also kills
> performance of Lua state machines
> sitting in updateHook(), since they are evaluated too many times.

This is indeed a nasty side-effect. If one requires the updateHook to
run after or during the operation, it should be triggered/called manually.

Was the reasoning behind this to have the latest data-flow information
available (assuming it is read during updateHook() )? Some people might
(unknowingly) depend on this behavior.

>
> 2. Installing a callback for an event port caused calling that
> callback AND updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is
> also related to users being surprised that an event port callback is
> only called periodically in periodic threads, while they thought it
> would be called immediately upon each event reception, and eventually
> updateHook periodically (but serialized with the callbacks).

We don't use callbacks, so no potential problem here.

>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file
> descriptor, ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior

Does 1) or 2) include event ports? I assume it does.

>
> I have some unfinished patches in my queue that try to prove this
> works, but maybe now is already a good time for feedback (just before
> I go on holidays :-). I think fixing 1) is actually fixing
> applications instead of breaking them. 2) causes more subtle
> changes... what do you think ?

Go for it :)

Best regards,
Robert

>
> Peter
>

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 9:09 AM, Robert Wilterdink
<r [dot] j [dot] w [dot] wilterdink [..] ...> wrote:
> On 04/04/2012 12:45 AM, Peter Soetens wrote:
>
> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>
>
> This is indeed a nasty side-effect. If one requires the updateHook to run
> after or during the operation, it should be triggered/called manually.
>
> Was the reasoning behind this to have the latest data-flow information
> available (assuming it is read during updateHook() )? Some people might
> (unknowingly) depend on this behavior.
>
>
> 2. Installing a callback for an event port caused calling that callback AND
> updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
>
> We don't use callbacks, so no potential problem here.
>
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
>
> Does 1) or 2) include event ports? I assume it does.

Indeed:

4) when an event port receives data and no 'override' callback was installed.

>
>
>
> I have some unfinished patches in my queue that try to prove this works, but
> maybe now is already a good time for feedback (just before I go on holidays
> :-). I think fixing 1) is actually fixing applications instead of breaking
> them. 2) causes more subtle changes... what do you think ?
>
>
> Go for it :)

Thanks |-)

Peter

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 12:45 AM, Peter Soetens <peter [..] ...>wrote:

> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback
> AND updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
> I have some unfinished patches in my queue that try to prove this works,
> but maybe now is already a good time for feedback (just before I go on
> holidays :-). I think fixing 1) is actually fixing applications instead of
> breaking them. 2) causes more subtle changes... what do you think ?
>

I do like the proposed behavior, so +1. I was very surprised when I learned
--the hard way-- how much updateHook was being triggered, and had to end up
coding around this behavior to emulate what I expected.

I am somewhat concerned about code breakage, though. I don't know how many
people rely on the current behavior.

Adolfo.

> Peter
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>

Changing the behaviour of updateHook()

On Wed, Apr 04, 2012 at 12:45:01AM +0200, Peter Soetens wrote:
> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to specifications),
> especially when 'OwnThread' operations are implemented OR called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch the
> asynchronous requests. Users found it confusing that updateHook was called
> during the use of operations. This also kills performance of Lua state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback AND
> updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also related
> to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook periodically
> (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor, ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
> I have some unfinished patches in my queue that try to prove this works, but
> maybe now is already a good time for feedback (just before I go on holidays
> :-). I think fixing 1) is actually fixing applications instead of breaking
> them. 2) causes more subtle changes... what do you think ?

+1

This seems the most "correct" behavior.

Markus

Changing the behaviour of updateHook()

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>:
> On Wed, Apr 04, 2012 at 12:45:01AM +0200, Peter Soetens wrote:
>> To all,
>>
>> This title that late at night, I'm sure I got your attention!
>>
>> It's serious though. We have observed lately two major issues:
>>
>> 1. updateHook() is called *too many times* (even according to specifications),
>> especially when 'OwnThread' operations are implemented OR called(!).
>> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch the
>> asynchronous requests. Users found it confusing that updateHook was called
>> during the use of operations. This also kills performance of Lua state machines
>> sitting in updateHook(), since they are evaluated too many times.
>>
>> 2. Installing a callback for an event port caused calling that callback AND
>> updateHook(), instead of calling only the callback.
>> -> The callback does not replace the call to updateHook(). This is also related
>> to users being surprised that an event port callback is only called
>> periodically in periodic threads, while they thought it would be called
>> immediately upon each event reception, and eventually updateHook periodically
>> (but serialized with the callbacks).
>>
>> The idea then rose to have updateHook() to only be called after:
>> 1) any call to TaskContext::trigger()
>> -> for activities which allow this user control
>> 2) the component's activity triggered itself (periodic, file descriptor, ...)
>> -> what users expect
>> 3) the component is being update()
>> -> for slave activity behavior
>>
>> I have some unfinished patches in my queue that try to prove this works, but
>> maybe now is already a good time for feedback (just before I go on holidays
>> :-). I think fixing 1) is actually fixing applications instead of breaking
>> them. 2) causes more subtle changes... what do you think ?
>
> +1
>
> This seems the most "correct" behavior.

Agree! As for the event ports with custom callbacks: it makes more
sense (and will be more intuitive) to let the user trigger the update
hook himself in the custom callback (if he wishes to do so!), rather
then always automatically execute it after the custom method.

Steven

>
> Markus
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

Changing the behaviour of updateHook()

Hi Peter,

rather than changing the behavior, it sounds to me like a bug fixing ;)

+1 to the changes you proposed.

Davide

On Wed, Apr 4, 2012 at 12:45 AM, Peter Soetens <peter [..] ...>wrote:

> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback
> AND updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
> I have some unfinished patches in my queue that try to prove this works,
> but maybe now is already a good time for feedback (just before I go on
> holidays :-). I think fixing 1) is actually fixing applications instead of
> breaking them. 2) causes more subtle changes... what do you think ?
>
> Peter
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>

Changing the behaviour of updateHook()

On Wednesday 04 April 2012 09:02:43 Davide Faconti wrote:
> Hi Peter,
>
> rather than changing the behavior, it sounds to me like a bug fixing ;)
>
> +1 to the changes you proposed.

+1.

The current behaviour has been confusing me a lot in the past. To avoid the
current (in my view) unexpected behaviour of UpdateHook I left mine empty in
almost all of my components.

Tinne

>
> Davide
>
> On Wed, Apr 4, 2012 at 12:45 AM, Peter Soetens
<peter [..] ...>wrote:
> > To all,
> >
> > This title that late at night, I'm sure I got your attention!
> >
> > It's serious though. We have observed lately two major issues:
> >
> > 1. updateHook() is called *too many times* (even according to
> > specifications), especially when 'OwnThread' operations are implemented
> > OR called(!).
> > -> This was due to internal bookkeeping of the ExecutionEngine to
> > dispatch the asynchronous requests. Users found it confusing that
> > updateHook was called during the use of operations. This also kills
> > performance of Lua state machines
> > sitting in updateHook(), since they are evaluated too many times.
> >
> > 2. Installing a callback for an event port caused calling that callback
> > AND updateHook(), instead of calling only the callback.
> > -> The callback does not replace the call to updateHook(). This is also
> > related to users being surprised that an event port callback is only
> > called periodically in periodic threads, while they thought it would be
> > called immediately upon each event reception, and eventually updateHook
> > periodically (but serialized with the callbacks).
> >
> > The idea then rose to have updateHook() to only be called after:
> > 1) any call to TaskContext::trigger()
> > -> for activities which allow this user control
> > 2) the component's activity triggered itself (periodic, file descriptor,
> > ...)
> > -> what users expect
> > 3) the component is being update()
> > -> for slave activity behavior
> >
> > I have some unfinished patches in my queue that try to prove this works,
> > but maybe now is already a good time for feedback (just before I go on
> > holidays :-). I think fixing 1) is actually fixing applications instead
> > of breaking them. 2) causes more subtle changes... what do you think ?
> >
> > Peter
> >
> >
> > --
> > Orocos-Dev mailing list
> > Orocos-Dev [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

Changing the behaviour of updateHook()

2012/4/4 Peter Soetens <peter [..] ...>:
> To all,
>
> This title that late at night, I'm sure I got your attention!
>
> It's serious though. We have observed lately two major issues:
>
> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).

what do you mean by "implemented" ? During the time you do the "addOperation" ?
what do you mean by called ? Doest that mean that : "I an aperiodic
component it triggers the updateHook ?" or/and "even in a periodic
component it triggers the updateHook out of the cycle" ?

> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>

x-( really ? Woaw. To illustrate your motivations, I'm very surprise
to discover those execution of the updateHook, and really really
really afraid about my app health ! It's for this kind of background
computations that I throwed ROS away of high timing features, I'm a
bit horified ;p

> 2. Installing a callback for an event port caused calling that callback AND
> updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior
>
> I have some unfinished patches in my queue that try to prove this works, but
> maybe now is already a good time for feedback (just before I go on holidays
> :-). I think fixing 1) is actually fixing applications instead of breaking
> them. 2) causes more subtle changes... what do you think ?
>

To my point of view :
_ It's an emergency to correct 1. And I am very impatient to
_ 2 would be a good thing for me as I am not using those callbacks
because of that strange updateHook triggering. So it won't break
anything on my side.

> Peter
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>

Changing the behaviour of updateHook()

On Wed, Apr 4, 2012 at 1:15 AM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
> 2012/4/4 Peter Soetens <peter [..] ...>:
>> To all,
>>
>> This title that late at night, I'm sure I got your attention!
>>
>> It's serious though. We have observed lately two major issues:
>>
>> 1. updateHook() is called *too many times* (even according to
>> specifications), especially when 'OwnThread' operations are implemented OR
>> called(!).
>
> what do you mean by "implemented" ? During the time you do the "addOperation" ?

implemented -> executed: People are surprised that each time an
ownThread operation is executed, updateHook of that component is
called as well.

> what do you mean by called ? Doest that mean that : "I an aperiodic
> component it triggers the updateHook ?" or/and "even in a periodic
> component it triggers the updateHook out of the cycle" ?

only 'called in aperiodic component': When you call another
component's OwnThread operation, your updateHook will be called as
well.

>
>> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
>> the asynchronous requests. Users found it confusing that updateHook was
>> called during the use of operations. This also kills performance of Lua
>> state machines
>> sitting in updateHook(), since they are evaluated too many times.
>>
>
> x-( really ? Woaw. To  illustrate your motivations, I'm very surprise
> to discover those execution of the updateHook, and really really
> really afraid about my app health ! It's for this kind of background
> computations that I throwed ROS away of high timing features, I'm a
> bit horified ;p

You have to know that 'by design & documented' every update of the EE
is causing a call to updateHook(), provided that the component is in
the running state. So you should have known :-) We came to realize
that 1) no one knows this and 2) it's not logical compared to the
other Hook functions 3) it exposes internal implementation decisions
to the user level.

>
>
>
>> 2. Installing a callback for an event port caused calling that callback AND
>> updateHook(), instead of calling only the callback.
>> -> The callback does not replace the call to updateHook(). This is also
>> related to users being surprised that an event port callback is only called
>> periodically in periodic threads, while they thought it would be called
>> immediately upon each event reception, and eventually updateHook
>> periodically (but serialized with the callbacks).
>>
>> The idea then rose to have updateHook() to only be called after:
>> 1) any call to TaskContext::trigger()
>> -> for activities which allow this user control
>> 2) the component's activity triggered itself (periodic, file descriptor,
>> ...)
>> -> what users expect
>> 3) the component is being update()
>> -> for slave activity behavior
>>
>> I have some unfinished patches in my queue that try to prove this works, but
>> maybe now is already a good time for feedback (just before I go on holidays
>> :-). I think fixing 1) is actually fixing applications instead of breaking
>> them. 2) causes more subtle changes... what do you think ?
>>
>
> To my point of view :
> _ It's an emergency to correct 1. And I am very impatient to
> _ 2 would be a good thing for me as I am not using those callbacks
> because of that strange updateHook triggering. So it won't break
> anything on my side.

Ok. thanks for the feedback.

Peter