[Bug 998] New: Cannot self-update a LuaComponent

http://bugs.orocos.org/show_bug.cgi?id=998

Summary: Cannot self-update a LuaComponent
Product: Toolchain
Version: master
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P3
Component: OCL
AssignedTo: orocos-dev [..] ...
ReportedBy: ruben [dot] smits [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Created attachment 830
--> http://bugs.orocos.org/attachment.cgi?id=830
testcase

This bug is somewhat related to Bug 945: Can't self-configure/start a
LuaComponent.

Although self-configuring and self-starting is working, updateHook seems to be
blocked:

I tested by executing the attached testcase

Executing this results in:

rttlua -i test.lua
Real-time memory: 517904 bytes free of 524288 allocated.
OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
configure
start
>

If I exit rttlua (Ctrl-D) the following is printed:

update
[...]
update
TLSF bytes allocated=524288 overhead=6384 max-used=6384 currently-used=6384
still-allocated=0

I think this might be caused by updateHook waiting for the mutex that is locked
by lua_repl, but is blocked since updateHook is executed in the Activity thread
which is not necessarily the same as the rttlua thread?

Ruben

Ruben Smits's picture

[Bug 998] Cannot self-update a LuaComponent

http://bugs.orocos.org/show_bug.cgi?id=998

Ruben Smits <ruben [dot] smits [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX

[Bug 998] New: Cannot self-update a LuaComponent

On Wed, Oct 17, 2012 at 11:13:14AM +0000, Ruben Smits wrote:
>
> http://bugs.orocos.org/show_bug.cgi?id=998
>
> Summary: Cannot self-update a LuaComponent
> Product: Toolchain
> Version: master
> Platform: All
> OS/Version: All
> Status: NEW
> Severity: major
> Priority: P3
> Component: OCL
> AssignedTo: orocos-dev [..] ...
> ReportedBy: ruben [dot] smits [..] ...
> CC: orocos-dev [..] ...
> Estimated Hours: 0.0
>
>
> Created attachment 830
> --> http://bugs.orocos.org/attachment.cgi?id=830
> testcase
>
> This bug is somewhat related to Bug 945: Can't self-configure/start a
> LuaComponent.
>
> Although self-configuring and self-starting is working, updateHook seems to be
> blocked:
>
> I tested by executing the attached testcase
>
> Executing this results in:
>
> rttlua -i test.lua
> Real-time memory: 517904 bytes free of 524288 allocated.
> OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
> configure
> start
> >
>
> If I exit rttlua (Ctrl-D) the following is printed:
>
> update
> [...]
> update
> TLSF bytes allocated=524288 overhead=6384 max-used=6384 currently-used=6384
> still-allocated=0
>
> I think this might be caused by updateHook waiting for the mutex that is locked
> by lua_repl, but is blocked since updateHook is executed in the Activity thread
> which is not necessarily the same as the rttlua thread?

Yes, the repl holding the mutex is running in the main thread, but the
activity is in a different one and has to wait. If you try to do this
in a separate component this works as expected, see attached modified
example.

IMHO this is not a bug, this is misuse of the rttlua deployer :-)

Markus

Ruben Smits's picture

[Bug 998] New: Cannot self-update a LuaComponent

On Wed, Oct 17, 2012 at 2:40 PM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> On Wed, Oct 17, 2012 at 11:13:14AM +0000, Ruben Smits wrote:
>>
>> http://bugs.orocos.org/show_bug.cgi?id=998
>>
>> Summary: Cannot self-update a LuaComponent
>> Product: Toolchain
>> Version: master
>> Platform: All
>> OS/Version: All
>> Status: NEW
>> Severity: major
>> Priority: P3
>> Component: OCL
>> AssignedTo: orocos-dev [..] ...
>> ReportedBy: ruben [dot] smits [..] ...
>> CC: orocos-dev [..] ...
>> Estimated Hours: 0.0
>>
>>
>> Created attachment 830
>> --> http://bugs.orocos.org/attachment.cgi?id=830
>> testcase
>>
>> This bug is somewhat related to Bug 945: Can't self-configure/start a
>> LuaComponent.
>>
>> Although self-configuring and self-starting is working, updateHook seems to be
>> blocked:
>>
>> I tested by executing the attached testcase
>>
>> Executing this results in:
>>
>> rttlua -i test.lua
>> Real-time memory: 517904 bytes free of 524288 allocated.
>> OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
>> configure
>> start
>> >
>>
>> If I exit rttlua (Ctrl-D) the following is printed:
>>
>> update
>> [...]
>> update
>> TLSF bytes allocated=524288 overhead=6384 max-used=6384 currently-used=6384
>> still-allocated=0
>>
>> I think this might be caused by updateHook waiting for the mutex that is locked
>> by lua_repl, but is blocked since updateHook is executed in the Activity thread
>> which is not necessarily the same as the rttlua thread?
>
> Yes, the repl holding the mutex is running in the main thread, but the
> activity is in a different one and has to wait. If you try to do this
> in a separate component this works as expected, see attached modified
> example.

In the meantime have worked out something similar.

> IMHO this is not a bug, this is misuse of the rttlua deployer :-)

I understand how this is misuse, but could we somehow alarm the user
about this misuse? Documentation, at runtime?

Ruben
> Markus
>

[Bug 998] New: Cannot self-update a LuaComponent

On Wed, Oct 17, 2012 at 02:46:34PM +0200, Ruben Smits wrote:
> On Wed, Oct 17, 2012 at 2:40 PM, Markus Klotzbuecher
> <markus [dot] klotzbuecher [..] ...> wrote:
> > On Wed, Oct 17, 2012 at 11:13:14AM +0000, Ruben Smits wrote:
> >>
> >> http://bugs.orocos.org/show_bug.cgi?id=998
> >>
> >> Summary: Cannot self-update a LuaComponent
> >> Product: Toolchain
> >> Version: master
> >> Platform: All
> >> OS/Version: All
> >> Status: NEW
> >> Severity: major
> >> Priority: P3
> >> Component: OCL
> >> AssignedTo: orocos-dev [..] ...
> >> ReportedBy: ruben [dot] smits [..] ...
> >> CC: orocos-dev [..] ...
> >> Estimated Hours: 0.0
> >>
> >>
> >> Created attachment 830
> >> --> http://bugs.orocos.org/attachment.cgi?id=830
> >> testcase
> >>
> >> This bug is somewhat related to Bug 945: Can't self-configure/start a
> >> LuaComponent.
> >>
> >> Although self-configuring and self-starting is working, updateHook seems to be
> >> blocked:
> >>
> >> I tested by executing the attached testcase
> >>
> >> Executing this results in:
> >>
> >> rttlua -i test.lua
> >> Real-time memory: 517904 bytes free of 524288 allocated.
> >> OROCOS RTTLua 1.0-beta5 / Lua 5.1.4 (gnulinux)
> >> configure
> >> start
> >> >
> >>
> >> If I exit rttlua (Ctrl-D) the following is printed:
> >>
> >> update
> >> [...]
> >> update
> >> TLSF bytes allocated=524288 overhead=6384 max-used=6384 currently-used=6384
> >> still-allocated=0
> >>
> >> I think this might be caused by updateHook waiting for the mutex that is locked
> >> by lua_repl, but is blocked since updateHook is executed in the Activity thread
> >> which is not necessarily the same as the rttlua thread?
> >
> > Yes, the repl holding the mutex is running in the main thread, but the
> > activity is in a different one and has to wait. If you try to do this
> > in a separate component this works as expected, see attached modified
> > example.
>
> In the meantime have worked out something similar.
>
> > IMHO this is not a bug, this is misuse of the rttlua deployer :-)
>
> I understand how this is misuse, but could we somehow alarm the user
> about this misuse? Documentation, at runtime?

Maybe we should avoid it altogether. I'm wondering why the
rttlua-deployer needs to be a component at all. Instead we could just
run the repl from ORO_main and add a function rtt.getDeployer() or
similar. Or am I missing a good reason for this?

Markus