Loading programs or state machines is not thread-safe ?

Hi,

I am using Orocos 1.6, under Gnu/Linux. In our application, we have to load programs during the updateHook, in order to execute user-defined scripts. We noticed that sometimes we have parsing errors, although the code of the script is correct ( The error is “Open curly brace '{' expected. ” ).

I have made a small test program (from rtt-example) where 100 tasks (100 threads) are started simultaneously, and load a program and a state machine in the first update hook. It produces errors for state machines and programs. If I use a Mutex around loadStateMachines and loadPrograms, the problem disappears.

I think that, usually, Orocos users load theirs programs and theirs state machines in the startHook, during the deployment (in a single thread) and have no problems.

Is it an Orocos limitation or bug, or a libc/c++ bug ?

Regards, Nicolas

Loading programs or state machines is not thread-safe ?

This mail was originally from Nicolas Mabire, but the ML admin interface
forwarded it under my name...

On Friday 29 January 2010 11:38:31 peter [dot] soetens [..] ... wrote:
> Hi,
>
> I am using Orocos 1.6, under Gnu/Linux.
> In our application, we have to load programs during the updateHook, in
> order to execute user-defined scripts. We noticed that sometimes we have
> parsing errors, although the code of the script is correct ( The error is
> “Open curly brace '{' expected. ” ).
>
> I have made a small test program (from rtt-example) where 100 tasks (100
> threads) are started simultaneously, and load a program and a state
> machine in the first update hook. It produces errors for state machines
> and programs. If I use a Mutex around loadStateMachines and loadPrograms,
> the problem disappears.
>
> I think that, usually, Orocos users load theirs programs and theirs state
> machines in the startHook, during the deployment (in a single thread) and
> have no problems.
>
> Is it an Orocos limitation or bug, or a libc/c++ bug ?

It was an Orocos bug. I have pushed the (big) fix to the 1.x trunk. It was not
trivial to solve, but the bug was due to using static variables, which, we all
know, are not thread safe. The 2.x mainline got the same patch.

Thanks for reporting,

Peter
--
Orocos-Users mailing list
Orocos-Users [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users