Hi,
I a m using Orocos RTT 1.6 under linux.
My Orocos project is composed of :
- one component called Master with a non periodic activity.
- 2 components called Slave1 and Slave2 with slave activities, peers from Master.
The Master calls (in its updateHook) Slave1.execute() and Slave2.execute().
Slave1 has a Command
During its updateHook Slave2 calls Slave1's command cmdTest and checks for cmdTest.done().
I launch the project and (from the TaskBrowser) I call Master.trigger() twice.
The first time it works.
The second time, the function bool doTest(string) is executed by Slave1 (normal) and then I get a log [FATAL] :
"Single Thread NonPeriodicActivity caught a C++ exception, stopping thread !".
The thread from the master is stopped.
I do not understand why ... No problem to call commands between slave activities triggered by the same master ?
If anybody has any idea ...
Thank you !
Renaud Heitz
NonPeriodic C++ exception
On Fri, Jun 26, 2009 at 14:07, <renaud [dot] heitz [..] ...> wrote:
> Hi,
>
> I a m using Orocos RTT 1.6 under linux.
>
> My Orocos project is composed of :
> - one component called Master with a non periodic activity.
> - 2 components called Slave1 and Slave2 with slave activities, peers from Master.
>
> The Master calls (in its updateHook) Slave1.execute() and Slave2.execute().
>
> Slave1 has a Command<bool(string)> cmdTest associated with functions bool doTest(string) (prints a log) and bool testDone() (returns true).
>
> During its updateHook Slave2 calls Slave1's command cmdTest and checks for cmdTest.done().
>
> I launch the project and (from the TaskBrowser) I call Master.trigger() twice.
> The first time it works.
'it works' : is the command already executed ?
When the command arrives in Slave1's queue, Slave1's activity is
triggered. In case Slave1's activity knows of its master activity (the
master activity was passed during construction of the slave activity),
the master is triggered in turn. This would lead to an 'infinite loop'
of triggers. So I'm assuming you're not in this case...?
> The second time, the function bool doTest(string) is executed by Slave1 (normal) and then I get a log [FATAL] :
> "Single Thread NonPeriodicActivity caught a C++ exception, stopping thread !".
> The thread from the master is stopped.
Orocos doesn't throw exceptions to users in the real-time path. The
only place this could originate from is the boost::shared_ptr
implementation which might throw, but I don't see it present in the
path you're describing.
I'll need to reconstruct this.
Peter
> I launch the project and
> I launch the project and (from the TaskBrowser) I call Master.trigger() twice.
> The first time it works.
> 'it works' : is the command already executed ?
No I mean there was no error. The command was called by Slave2 but not executed by Slave1.
> When the command arrives in Slave1's queue, Slave1's activity is
> triggered. In case Slave1's activity knows of its master activity (the
> master activity was passed during construction of the slave activity),
> the master is triggered in turn. This would lead to an 'infinite loop'
> of triggers. So I'm assuming you're not in this case...?
Indeed : the 2 Slaves do not know the Master.
> Orocos doesn't throw exceptions to users in the real-time path. The
> only place this could originate from is the boost::shared_ptr
> implementation which might throw, but I don't see it present in the
> path you're describing.
The exception is caught and logged by Orocos but I do not know who threw it.
I have one more information : The prototype of the command is not exactly what I wrote : it is Command and the cooresponding functions are : bool doTest(const string& s) and bool testDone(void).
I am using reference on the string parameter ... is that a problem ?
Thank you for your help,
Renaud Heitz
Re: NonPeriodic C++ exception
> I have one more information : The prototype of the command is not exactly what I wrote : it is and the cooresponding functions are : bool doTest(const string& s) and bool
> Command
> testDone(void).
> I am using reference on the string parameter ... is that a problem ?
If I do not use the reference on the string It seems I do not have the error any more ... ; bool doTest(string) ; bool testDone() ;
With these prototypes it works :
Command
I do not understand why, though.
Renuad Heitz
NonPeriodic C++ exception
2009/6/29 renaud.heitz <renaud [dot] heitz [..] ...>:
>> I have one more information : The prototype of the command is not exactly what I wrote : it is
>> Command<bool(const string&)> and the cooresponding functions are : bool doTest(const string& s) and bool
>> testDone(void).
>> I am using reference on the string parameter ... is that a problem ?
>
> If I do not use the reference on the string It seems I do not have the error any more ...
> With these prototypes it works :
> Command<bool(string)> ; bool doTest(string) ; bool testDone() ;
>
> I do not understand why, though.
I believe the exception can be triggered by only two things: 1. or the
command object was destroyed before the command function was executed
or 2. the string to which the reference pointed was already destroyed
when the command function was executed. It's probably C++ scope
trickery. I'd need to see a minimal example that demonstrates your
observed behavior to be sure though.
Peter
NonPeriodic C++ exception
My problem is most likely your second point :
> 2. the string to which the reference pointed was already destroyed
> when the command function was executed.
The string I use as parameter is a local variable from the function that calls the command.
> It's probably C++ scope trickery.
Indeed.
I had expected that Command parameters, when copied in the Command queue from a component would be really copied (and reference only used for intermediate orocos function call). Sorry, my mistake.
Thank you for your help,
Renaud
> I launch the project and
Are you using the deployer to create your application? Because I was not
able to create slave activities in deployer. But same code with a main() in
c++ work fine.
Mayby you would show us the error message...
Mike
-----Original Message-----
From: orocos-users-bounces [..] ...
[mailto:orocos-users-bounces [..] ...] On Behalf Of
renaud [dot] heitz [..] ...
Sent: 26 juin 2009 12:48
To: orocos-users [..] ...
Subject: [Orocos-users] > I launch the project and
> I launch the project and (from the TaskBrowser) I call Master.trigger()
twice.
> The first time it works.
> 'it works' : is the command already executed ?
No I mean there was no error. The command was called by Slave2 but not
executed by Slave1.
> When the command arrives in Slave1's queue, Slave1's activity is
> triggered. In case Slave1's activity knows of its master activity (the
> master activity was passed during construction of the slave activity),
> the master is triggered in turn. This would lead to an 'infinite loop'
> of triggers. So I'm assuming you're not in this case...?
Indeed : the 2 Slaves do not know the Master.
> Orocos doesn't throw exceptions to users in the real-time path. The
> only place this could originate from is the boost::shared_ptr
> implementation which might throw, but I don't see it present in the
> path you're describing.
The exception is caught and logged by Orocos but I do not know who threw it.
I have one more information : The prototype of the command is not exactly
what I wrote : it is Command<bool(const string&)> and the cooresponding
functions are : bool doTest(const string& s) and bool testDone(void).
I am using reference on the string parameter ... is that a problem ?
Thank you for your help,
Renaud Heitz
> Are you using the
> Are you using the deployer to create your application? Because I was not
> able to create slave activities in deployer. But same code with a main() in
> c++ work fine.
I use the deployer but not with the xml configuration file from the deployer. I create a program.ops file that calls the depoyer's methods : setSlaveActivity("Slave1", 0);
To deploy my application I execute the program.ops.
> Maybe you would show us the error message...
The error message was in my first post : log[FATAL] : "Single Thread NonPeriodicActivity caught a C++ exception, stopping thread !".
Renaud Heitz