Yarp: [MAC OS X] Can't launch applications through yarprun

Created on 5 Nov 2015  路  5Comments  路  Source: robotology/yarp

Hello there,
I have checked with other laptops to see if yarprun works fine and apparently it's a problem of my current system configuration. But I can't figure out what the problem is and I would appreciate any hint. The steps I follow are the following:

  1. yarpserver
  2. yarprun --server /jorh
  3. yarprun --on /jorh --as whatever --cmd iCubGui

These are my logs for each terminal after the final command.
From yarpserver I get

Jorhabibs-MacBook-Pro:~ jeljaik$ yarpserver
__   __ _    ____  ____  
\ \ / // \  |  _ \|  _ \ 
 \ V // _ \ | |_) | |_) |
  | |/ ___ \|  _ <|  __/ 
  |_/_/   \_\_| \_\_|    

Call with --help for information on available options
Using port database: :memory:
Using subscription database: :memory:
IP address: default
Port number: 10000
yarp: Port /root active at tcp://192.168.36.77:10000

Registering name server with itself:
 * register "/root" tcp "192.168.36.77" 10000
   + set "/root" ips "127.0.0.1" "192.168.36.77"
   + set "/root" process 758
 * register fallback mcast "224.2.1.1" 10000
   + set fallback ips "127.0.0.1" "192.168.36.77"
   + set fallback process 758
Name server can be browsed at http://192.168.36.77:10000/

Ok.  Ready!
 * register "/jorh"
   + set "/jorh" ips "127.0.0.1" "192.168.36.77"
   + set "/jorh" process 759
-> announce "/jorh"
 * register "..."
 * set "/tmp/port/1" ips "127.0.0.1" "192.168.36.77"
 * set "/tmp/port/1" process 761
-> announce "/tmp/port/1"
 * query "/tmp/port/1"
 * query "/jorh"
 * query "/jorh"
 * query "/tmp/port/1"
 * query "/jorh"
 * unregister "/tmp/port/1"

From yarprun

Jorhabibs-MacBook-Pro:~ jeljaik$ yarprun --server /jorh
^CJorhabibs-MacBook-Pro:~ jeljaik$ yarprun --server /jorh
STARTED: server=/jorh alias=whatever cmd=iCubGui pid=762

From the yarprun cmd:

Jorhabibs-MacBook-Pro:~ jeljaik$ yarprun --on /jorh --as whatever --cmd iCubGui
yarp: Port /tmp/port/1 active at tcp://192.168.36.77:10003
yarp: Sending output from /tmp/port/1 to /jorh using tcp
yarp: Removing output from /tmp/port/1 to /jorh
RESPONSE:
=========
762
STARTED: server=/jorh alias=whatever cmd=iCubGui pid=762

After this, I don't get iCubGui anywhere. I can launch it however without yarprun so I believe it's got nothing to do with its installation. Also when I try to launch an application through yarpmanager on a node different from localhost the modules won't start.

Any idea?

OS X 10.11.1
YARP version 2.3.64.8
iCub version 1.2.17

Library - YARP_os Tool - yarprun YARP v2.3.66.1 macOS Fixed

Most helpful comment

Good stackoverflow gave me a hint:

The problem was that a thread was created before fork() and after fork() there was no thread in app while C++ thought there's one. That's why join() on joinable thread threw an error ESRCH

All 5 comments

Did you install yarp and icub-main from binaries or from source?

Binaries -> no clue, hopefully some Mac OS X user can come along and help. :)

Source -> read on.

It could be that the commands launched via yarprun and yarpmanager do not see the correct environment variables like $PATH, thus they cannot find binaries like iCubGui.

Not sure about Mac OS X, but in Linux I would fix it like this:

First put the desired variables in your .bashrc_iCub file, example:

 export CODE=/home/yourname/code
 export YARP_ROOT=$CODE/yarp
 export YARP_DIR=$YARP_ROOT/build
 export ICUB_ROOT=$CODE/icub-main
 export ICUB_DIR=$CODE/icub-main/build
 export YARP_DATA_DIRS=$YARP_DIR/share/yarp:$ICUB_DIR/share/iCub
 export PATH=$PATH:$YARP_DIR/bin:$ICUB_DIR/bin
 export ICUB_ROBOTNAME=your_robotname

Then make sure that the rc file is loaded both during interactive (terminal) and non-interactive (yarprun) sessions, by putting these lines

# per-user environment variables (non-interactive and interactive mode)
source $HOME/.bashrc_iCub

at the beginning of /etc/bash.bashrc, before the line that says [ -z "$PS1" ] && return

See also:

I am experiencing similar problems on my MacBook. @jeljaik any update on your side?

Thank you @gsaponaro I installed both yarp and icub-main from sources, I have checked as you suggested the environmental variables seen by xterm through xterm -hold -e "printenv"but they seem to be updated correctly.

screen shot 2015-11-09 at 11 03 31 am

I managed to replicate the issue.
The problem is if C++11 is enabled.
And the problem is occurring at line https://github.com/robotology/yarp/blob/master/src/libYARP_OS/src/ThreadImpl.cpp#L174 which with c++11 crashes with

libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: thread::join failed: No such process

This is called by
https://github.com/robotology/yarp/blob/master/src/libYARP_OS/src/Run.cpp#L762

Additional information of the error: backtrace at the point of the exception

0   libYARP_OS.1.dylib                  0x0000000101fb2b8b _ZN4yarp2os4impl10ThreadImpl4joinEd + 4299
1   libYARP_OS.1.dylib                  0x0000000101fb3be3 _ZN4yarp2os4impl10ThreadImpl5closeEv + 355
2   libYARP_OS.1.dylib                  0x0000000101fb0163 _ZN21ThreadCallbackAdapter5closeEv + 227
3   libYARP_OS.1.dylib                  0x0000000101faf9f2 _ZN4yarp2os6Thread4stopEv + 274
4   libYARP_OS.1.dylib                  0x0000000101f60355 _ZN4yarp2os3Run15cleanBeforeExecEv + 261
5   libYARP_OS.1.dylib                  0x0000000101f76654 _ZN4yarp2os3Run10executeCmdERNS0_6BottleES3_ + 11700
6   libYARP_OS.1.dylib                  0x0000000101f51f5f _ZN4yarp2os3Run6serverEv + 17327
7   libYARP_OS.1.dylib                  0x0000000101f4acc4 _ZN4yarp2os3Run4mainEiPPc + 3796
8   yarprun                             0x0000000101ca1dbc main + 252
9   libdyld.dylib                       0x00007fff958c25ad start + 1

Good stackoverflow gave me a hint:

The problem was that a thread was created before fork() and after fork() there was no thread in app while C++ thought there's one. That's why join() on joinable thread threw an error ESRCH

Was this page helpful?
0 / 5 - 0 ratings