Recent Changes - Search:

edit SideBar

HLA

This page is no longer maintained, see https://www.icyphy.org/hla/wiki/Main/HomePage

Internal Resources

Notes

HLA Test Case Failure

The test has been failing for some time on sisyphus.

/home/hudson/jobs/ptII/workspace/ptolemy/apps/hlacerti/lib/test/HLATest.tcl
testDefs.tcl: setting time out to 7200 seconds at Thu Jan 29 20:47:38 PST 2015
HLATest.tcl: Be sure to source certi/share/scripts/myCERTI_env.sh
sleeping 1 seconds: sleeping 5 seconds: 339 ms. Memory: 310272K Free: 296450K (96%)
105 ms. Memory: 310272K Free: 296450K (96%)


==== $PTII/ptolemy/apps/hlacerti/lib/test/HLATest.tcl: HLATest-1.0 Run the HLA MultiDataTypes
==== Contents of test case:


        # Success is when the Test actor in the consumer gets all of its values.

        set consumerListenerOutput [java::new java.io.ByteArrayOutputStream]
        set consumer [runModel MultiDataTypesConsumer.xml $consumerListenerOutput]
        sleep 1 false
        set producerListenerOutput [java::new java.io.ByteArrayOutputStream]
        set producer [runModel MultiDataTypesProducer.xml $producerListenerOutput]
       # Return something useful as another check
        sleep 5 false
        list [$consumer getFullName] [$producer getFullName]  [$consumerListenerOutput toString] [$producerListenerOutput toString]

==== Result was:
.MultiDataTypesConsumer .MultiDataTypesProducer {preinitializing
resolving types
initializing
} {preinitializing
resolving types
initializing
}
---- Result should have been:
.MultiDataTypesConsumer .MultiDataTypesProducer {preinitializing
resolving types
initializing
} {preinitializing
resolving types
initializing
executing number 1
}
@@@@@ known results is more than 7 lines long, so we run diff
7d6
< executing number 1
@@@@@ Done running diffText
---- HLATest-1.0 FAILED

Running the test under Mac OS passes some times.

If rtig is not running, then I get:

> Execution error.
> ptolemy.kernel.util.IllegalActionException: RTIinternalError
> in .MultiDataTypesProducer.producer
> Because:
> Connection to RTIA failed. null

It turns out that there were two errors

  1. The HLATest.tcl was creating listeners inside a Tcl function, and the listeners were getting gc'd and the results from listening to the Manager was differing between runs. The fix is to add the listeners to a list so that they don't get gc'd.
  2. CertiRtig was setting LD_LIBRARY_PATH to just the certi lib directory, but the rtig binary needs libraries from other directories.

Building CERTI on the Mac

1/30/2015

See ptolemy/apps/hlacerti/INSTALL_CERTI.txt:

cd ~/src
wget http://download.savannah.gnu.org/releases/certi/CERTI-3.4.2-Source.tar.gz
tar -zxf CERTI-3.4.2-Source.tar.gz
cd CERTI-3.4.2-Source
mkdir build_certi
cd build_certi
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/certi-3.4.2 -DCERTI_USE_NULL_PRIME_MESSAGE_PROTOCOL=ON ../
make

Problems building CERTI-3.4.2 on the Mac

Problem: implicit instantiation of undefined template 'std::auto_ptr<rti1516::LogicalTime>'

[ 71%] Building CXX object libRTI/CMakeFiles/FedTime1516.dir/RTI1516fedTime.cpp.o
/Users/cxh/src/CERTI-3.4.2-Source/libRTI/RTI1516fedTime.cpp:802:24: error: implicit instantiation of undefined template
      'std::auto_ptr<rti1516::LogicalTime>'
RTI1516fedTimeFactory::makeLogicalTime()
                       ^
/Users/cxh/src/CERTI-3.4.2-Source/include/RTI/certiLogicalTimeFactory.h:36:28: note: template is declared here
  template <class T> class auto_ptr;
                           ^
/Users/cxh/src/CERTI-3.4.2-Source/libRTI/RTI1516fedTime.cpp:807:9: error: implicit instantiation of undefined template
      'std::auto_ptr<rti1516::LogicalTime>'
        return std::auto_ptr< rti1516::LogicalTime >(fedTime);
 

make -n indicates we are running /usr/bin/c++ which is Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)

Solution: As root:

 cd /opt/local/bin ln -s g++-mp-4.9 c++

CERTI-3.4.2: fatal error: X11/bitmaps/cntr_ptr: No such file or directory

[ 84%] Building CXX object test/libgraphc/CMakeFiles/graph.dir/graph_c.cc.o
/Users/cxh/src/CERTI-3.4.2-Source/test/libgraphc/graph_c.cc:34:32: fatal error: X11/bitmaps/cntr_ptr: No such file or directory
#include <X11/bitmaps/cntr_ptr>

Solution: As root port install bitmap

rtig: Bind Address already in use

bash-3.2$ rtig
CERTI RTIG 3.4.2 - Copyright 2002-2008 ONERA
This is free software ; see the source for copying conditions. There is NO
warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SocketUDP: Bind: Address already in use
CERTI RTIG aborted with a Network Error: [Cannot bind UDP Socket].
CERTI RTIG exiting.

Solution: Use ps to find the other rtig process and kill it.

Or

 export CERTI_UDP_PORT=1235
 export CERTI_TCP_PORT=1237
 export CERTI_HOST=127.0.0.1
 rtig -l 127.0.0.1

FIXME: The CERTI code should prompt the user to use -l if there is an error.

Running the Billiard demo

 rtig &

In two separate windows:

 billard -f Test.fed -F Test.xml -n1 

and

 billard -f Test.fed -F Test.xml -n2

An X11 window should appear.

Problems under El Capitan

After installing Ptolemy and CERTI in El Captain using the instructions in $PTII/ptolemy/apps/hlacerti/manual-ptii-hla.pdf

the demos using HLA/CERTI in $PTII/ptolemy/apps/hlacerti/demo (e.g., Billard/FederationBillard.xml) do not work:

  • Ptolemy models are stuck with the message "initializing." in the left bottom corner,
  • In the terminal where Ptolemy was launched appears the message:
CertRtig: the os.name property is: Mac OS X
CertiRtig: .fed1.HlaManager: About to invoke rtig: 
command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, CoSimu.fed]
environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
directory: /Users/cxh/pthla/ptII/org/hlacerti/demo/Billard
_read(): dyld: Library not loaded: libCERTId.3.dylib
  Referenced from: /Users/cxh/pthla/certi-tools/bin/rtig
  Reason: image not found

For other errors, please read section Appendix B (Error messages) of $PTII/ptolemy/apps/hlacerti/manual-ptii-hla.pdf.

What was happening was that running the model as a non-root user was failing, but running the model as root would work.

Even more interestingly, if the rtig process was run as a non-root user, then running the model as root would work, but as non-root would not. This probably has to do with SIP (details below).

How to install CERTI under El Capitan:

  1. See $PTII/ptolemy/apps/hlacerti/manual-ptii-hla.pdf and do a clean install of CERTI in ~/pthla
  2. As root, create links in /usr/local/lib as indicated in $PTII/ptolemy/apps/hlacerti/manual-ptii-hla.pdf:
    bash-3.2$ pwd
    /Users/cxh/pthla/certi/build-certi
    bash-3.2$ sudo -i
    Password:
    ealmac23:~ root# whoami
    root
    ealmac23:~ root# cd /usr/local/lib
    ealmac23:~ root# ln -s /Users/cxh/pthla/certi-tools/lib/* .
    ealmac23:lib root# exit
    logout
    bash-3.2$ whoami
    cxh
    bash-3.2$
  3. As your regular, non-root user, set the variables:
    source ~/pthla/certi-tools/share/scripts/myCERTI_env.sh
  4. Run the model:
    export $PTII=~/ptII
    $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml

If there are problems running the Ptolemy HLA demos under El Capitan

  1. Try running rtig by hand on the .fed file:
    bash-3.2$ which rtig
    /Users/cxh/pthla/certi-tools/bin/rtig
    bash-3.2$ rtig $PTII/org/hlacerti/demo/Billard/Test.fed
    CERTI RTIG 3.5.1 - Copyright 2002-2008  ONERA
    This is free software ; see the source for copying conditions. There is NO
    warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    CERTI RTIG up and running ...
    1. If rtig does not start up from the shell, then the myCERTI_env.sh was either not sourced properly or there are other problems
  2. Ptolemy is a Java process that invokes /bin/sh -c so that it can set DY_LD_LIBRARY_PATH. This probably does not do much under El Capitan, but it will help other versions of Mac OS and Linux. Run the Ptolemy model
    bash-3.2$ $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml
    CertRtig: the os.name property is: Mac OS X
    CertiRtig: .TwoBilliardBalls.HlaManager: About to invoke rtig:
    command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
    environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
    directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
    CertRtig: the os.name property is: Mac OS X
    CertiRtig: .PoolTable2.display: About to invoke rtig:
    command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
    environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
    directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
    CertiRtig: .PoolTable2.display: About to terminate rtig.
    7610 ms. Memory: 274944K Free: 88462K (32%)
    6493 ms. Memory: 274944K Free: 88462K (32%)
    7864 ms. Memory: 274944K Free: 86122K (31%)
    1. If there are problems: /Applications/Utilities/Console, then run the model as non-root and look for new errors.
    2. Or, as a different user (I used root), source the myCERTI_env.sh script and try running the model.

Notes about various efforts to get CERTI to work under El Capitan

Below are notes about various things that were tried.

System Integrity Protection (SIP)

System Integrity Protection (SIP) was introduced in El Capitan in an effort to increase the security of the Mac OS.

Summary: To get CERTI to work, links need to be made for the shared libraries. It could be that installing CERTI in /usr/local would do the trick, see https://support.apple.com/en-us/HT204899:

"Paths and applications that third-party apps and installers can write to include:

  • /Applications
  • /Library
  • /usr/local

"

BTW - For one user, the problem was not just SIP, but I also had multiple versions of CERTI installed.

One way to check is to run:

$PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml &

Then start the model.

Then check for rtig processes:

bash-3.2$ ps auxgww | grep rtig
cxh              2430   0.0  0.0  2444056    800 s007  S+    4:30PM   0:00.00 grep rtig
cxh              2423   0.0  0.0  2505276   2704 s007  S     4:23PM   0:00.98 /Users/cxh/pthla/certi-tools/bin/rtig
bash-3.2$

Note that the rtig processes is running for me.

Also, we can use telnet to connect to port 60400:

bash-3.2$ telnet localhost 60400
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
?
^]

telnet> quit

The fact that there is a process at port 60400 indicates that the process is running and that SIP is not totally blocking execution.

As root, running the demo works:

On a machine where SIP is Enabled (to check reboot, hold Command-R, run csrutil status. See How to modify system integrity protection in El Capitan.)

sh-3.2# bash
bash-3.2# source ~cxh/pthla/certi-tools/share/scripts/myCERTI_env.sh
CERTI version <3.5.1>
Current machine architecture is <x86_64>.
==========================================================
** WARNING ** We hope you have made source myCERTI.sh **
                                    ------
If yes your variables for CERTI are now :
CERTI_HOST      =  localhost
CERTI_HOME      =  /Users/cxh/pthla/certi-tools
CERTI_FOM_PATH  =  /Users/cxh/pthla/certi-tools/share/federations
PATH            =  /opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:\
/opt/X11/bin:/usr/texbin:/Users/cxh/pthla/certi-tools/share/scripts:/Users/cxh/\
pthla/certi-tools/bin:/opt/local/bin:/opt/local/sbin:/usr/local/certi-3.4.3/sha\
re/scripts:/usr/local/certi-3.4.3/bin:/Applications/MatlabR2015a/MATLAB_R2015a.\
app/bin:/Library/TeX/Root/bin/x86_64-darwin
LD_LIBRARY_PATH =  /Users/cxh/pthla/certi-tools/lib:
DYLD_LIBRARY_PATH =  /Users/cxh/pthla/certi-tools/lib:
bash-3.2# export PTII=~cxh/ptII
bash-3.2# $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml
CertRtig: the os.name property is: Mac OS X
CertiRtig: .TwoBilliardBalls.HlaManager: About to invoke rtig:
command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
CertRtig: the os.name property is: Mac OS X
CertiRtig: .PoolTable2.display: About to invoke rtig:
command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
CertiRtig: .PoolTable2.display: About to terminate rtig.
7522 ms. Memory: 418304K Free: 95911K (23%)
6423 ms. Memory: 418304K Free: 95911K (23%)
7762 ms. Memory: 418304K Free: 95911K (23%)

The results:

However, running not as root with the above commands fails, the Ptolemy stack trace is:

tolemy.kernel.util.IllegalActionException: Execution failed.
  in .Billard.PoolTable
Because:
RTIinternalError. If the error is "Connection to RTIA failed", then the problem is likely that the rtig binary could not be started by CertRtig. One way to debug this is to set the various environment variables by sourcing certi/share/scripts/myCERTI_env.sh, then invoking rtig on the .fed file then rerunning the model.
  in .PoolTable2.display
Because:
Connection to RTIA failed. null
        at ptolemy.actor.lib.hoc.ModelReference.fire(ModelReference.java:588)
        at ptolemy.vergil.actor.lib.VisualModelReference.fire(VisualModelReference.java:388)
        at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:497)
        at ptolemy.actor.Director.fire(Director.java:360)
        at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
        at ptolemy.actor.Manager.iterate(Manager.java:841)
        at ptolemy.actor.Manager.execute(Manager.java:367)
        at ptolemy.actor.Manager.run(Manager.java:1252)
        at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1903)
Caused by: ptolemy.kernel.util.IllegalActionException: RTIinternalError. If the error is "Connection to RTIA failed", then the problem is likely that the rtig binary could not be started by CertRtig. One way to debug this is to set the various environment variables by sourcing certi/share/scripts/myCERTI_env.sh, then invoking rtig on the .fed file then rerunning the model.
  in .PoolTable2.display
Because:
Connection to RTIA failed. null
        at org.hlacerti.lib.HlaManager.initialize(HlaManager.java:580)
        at ptolemy.actor.CompositeActor.initialize(CompositeActor.java:906)
        at ptolemy.actor.Manager.initialize(Manager.java:715)
        at ptolemy.actor.Manager.execute(Manager.java:354)
        at ptolemy.actor.lib.hoc.ModelReference.fire(ModelReference.java:586)
        ... 8 more
Caused by: hla.rti.RTIinternalError: Connection to RTIA failed. null serial:0
        at certi.rti.impl.CertiRtiAmbassador.<init>(Unknown Source)
        at certi.rti.jlc.CertiRtiFactory.createRtiAmbassador(Unknown Source)
        at org.hlacerti.lib.HlaManager.initialize(HlaManager.java:578)
        ... 12 more
Caused by: ptolemy.kernel.util.IllegalActionException: RTIinternalError. If the error is "Connection to RTIA failed", then the problem is likely that the rtig binary could not be started by CertRtig. One way to debug this is to set the various environment variables by sourcing certi/share/scripts/myCERTI_env.sh, then invoking rtig on the .fed file then rerunning the model.
  in .PoolTable2.display
Because:
Connection to RTIA failed. null
        at org.hlacerti.lib.HlaManager.initialize(HlaManager.java:580)
        at ptolemy.actor.CompositeActor.initialize(CompositeActor.java:906)
        at ptolemy.actor.Manager.initialize(Manager.java:715)
        at ptolemy.actor.Manager.execute(Manager.java:354)
        at ptolemy.actor.lib.hoc.ModelReference.fire(ModelReference.java:586)
        at ptolemy.vergil.actor.lib.VisualModelReference.fire(VisualModelReference.java:388)
        at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:497)
        at ptolemy.actor.Director.fire(Director.java:360)
        at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
        at ptolemy.actor.Manager.iterate(Manager.java:841)
        at ptolemy.actor.Manager.execute(Manager.java:367)
        at ptolemy.actor.Manager.run(Manager.java:1252)
        at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1903)
Caused by: hla.rti.RTIinternalError: Connection to RTIA failed. null serial:0
        at certi.rti.impl.CertiRtiAmbassador.<init>(Unknown Source)
        at certi.rti.jlc.CertiRtiFactory.createRtiAmbassador(Unknown Source)
        at org.hlacerti.lib.HlaManager.initialize(HlaManager.java:578)
        ... 12 more
Caused by: hla.rti.RTIinternalError: Connection to RTIA failed. null serial:0
        at certi.rti.impl.CertiRtiAmbassador.<init>(Unknown Source)
        at certi.rti.jlc.CertiRtiFactory.createRtiAmbassador(Unknown Source)
        at org.hlacerti.lib.HlaManager.initialize(HlaManager.java:578)
        at ptolemy.actor.CompositeActor.initialize(CompositeActor.java:906)
        at ptolemy.actor.Manager.initialize(Manager.java:715)
        at ptolemy.actor.Manager.execute(Manager.java:354)
        at ptolemy.actor.lib.hoc.ModelReference.fire(ModelReference.java:586)
        at ptolemy.vergil.actor.lib.VisualModelReference.fire(VisualModelReference.java:388)
        at ptolemy.actor.AtomicActor.iterate(AtomicActor.java:497)
        at ptolemy.actor.Director.fire(Director.java:360)
        at ptolemy.actor.CompositeActor.fire(CompositeActor.java:454)
        at ptolemy.actor.Manager.iterate(Manager.java:841)
        at ptolemy.actor.Manager.execute(Manager.java:367)
        at ptolemy.actor.Manager.run(Manager.java:1252)
        at ptolemy.actor.Manager$PtolemyRunThread.run(Manager.java:1903)

As non-root, the rtig binary starts up:

bash-3.2$ cd $PTII/org/hlacerti/demo/Billard
bash-3.2$ /bin/sh -c /Users/cxh/pthla/certi-tools/bin/rtig Test.fed
CERTI RTIG 3.5.1 - Copyright 2002-2008  ONERA
This is free software ; see the source for copying conditions. There is NO
warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CERTI RTIG up and running ...
  C-c C-cCERTI RTIG exiting.
bash-3.2$

Note that otool -L lists the shared libraries:

bash-3.2$ otool -L /Users/cxh/pthla/certi-tools/bin/rtig
/Users/cxh/pthla/certi-tools/bin/rtig:
        libCERTId.3.dylib (compatibility version 3.0.0, current version 3.5.1)
        /opt/local/lib/libxml2.2.dylib (compatibility version 12.0.0, current version 12.2.0)
        libHLAd.3.dylib (compatibility version 3.0.0, current version 3.5.1)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
bash-3.2$

So, the problem is running Java and then trying to run rtig

Starting $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml as a non-root user shows these libraries are in the the java.library.path JDK property:

  java.library.path = /Users/cxh/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.:/Users/cxh/ptII/lib

Note that the value of $DYLD_LIBRARY_PATH is ignored, but that /Users/cxh/ptII/lib is searched. That's because we set that property for Matlab.

Running rtig as non-root and Ptolemy as root works

However, it seems that running rtig from the command line as non-root works, if the Java process as run as root.

To replicate:

Edit org/hlacerti/lib/CertiRtig.java and in _read() have hit print out the value of _stringBuffer, then recompile.

As non-root:

bash-3.2$ cd $PTII/org/hlacerti/demo/Billard
bash-3.2$ ls
Autorun.xml             PoolTable2.xml          Synchro.xml
Billard.xml             PoolTable3.xml          Test.fed
DisplayWithFedName.xml  README.txt              TwoBilliardBalls.xml
DisplayWithoutPort.xml  RTIG.log                makefile
FederationBillard.xml   SingleBillardBall.xml
bash-3.2$ /Users/cxh/pthla/certi-tools/bin/rtig Test.fed
CERTI RTIG 3.5.1 - Copyright 2002-2008  ONERA
This is free software ; see the source for copying conditions. There is NO
warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CERTI RTIG up and running ...

As root:

bash-3.2# $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml
CertRtig: the os.name property is: Mac OS X
CertiRtig: .TwoBilliardBalls.HlaManager: About to invoke rtig:
command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
_read(): CERTI RTIG 3.5.1 - Copyright 2002-2008  ONERA
This is free software ; see the source for copying conditions. There is NO
warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CERTI RTIG exiting.

_read(): CERTI RTIG aborted with a Network Error: [Cannot bind UDP SocketAddres\
s already in use].

CertRtig: the os.name property is: Mac OS X
CertiRtig: .PoolTable2.display: About to invoke rtig:
command: [/bin/sh, -c, /Users/cxh/pthla/certi-tools/bin/rtig, Test.fed]
environment: [DYLD_LIBRARY_PATH=/Users/cxh/pthla/certi-tools/lib]
directory: /Users/cxh/ptII/org/hlacerti/demo/Billard
_read(): CERTI RTIG 3.5.1 - Copyright 2002-2008  ONERA
This is free software ; see the source for copying conditions. There is NO
warranty ; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CERTI RTIG exiting.

_read(): CERTI RTIG aborted with a Network Error: [Cannot bind UDP SocketAddress already in use].

CertiRtig: .PoolTable2.display: About to terminate rtig.
7357 ms. Memory: 433152K Free: 378193K (87%)
6258 ms. Memory: 433152K Free: 378193K (87%)
7591 ms. Memory: 433152K Free: 378193K (87%)

Note that root tries to start up rtig, but it is already running.

Recompiling JCERTI

  1. Download: git clone git://git.savannah.nongnu.org/certi/jcerti.git
  2. cd jcerti
  3. Edit build.xml and enable debugging in the javac command:
                    <javac srcdir="${src.dir}" includeantruntime="false" destdir="${class.dir}" target="1.5" source="1.5" deprecation="on" debug="on">
  4. Run ant
  5. Copy the jar file: cp ./build/jar/jcerti.jar $PTII/lib/jcerti.jar
  6. Run the model: $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml

Debugging JCERTI

  1. Edit jcerti/src/certi/communication/MessageBuffer.java:
        public String toString() {
            return super.toString() + "size: " + buffer.size();
        }
  2. Edit jcerti/src/certi/communication/MessageFactory.java and add a println:
        public static CertiMessage readMessage(MessageBuffer messageBuffer) throws IOException, CertiException {
            messageBuffer.receiveData();

            System.out.println("MessageFactory.readMessage(): " + messageBuffer);
            CertiMessage message = instantiate(CertiMessageType.reverseType.get(mes\
    sageBuffer.readInt())); //read first integer from header and instantiate class  

            message.readMessage(messageBuffer);

            return message;
        }
  3. Edit jcerti/src/certi/rti/impl/CertiRtiAmbassador.java and print the stack trace:
            ////////////////////                                                    
            // Open connexion //                                                    
            ////////////////////                                                    
            try {
                OpenConnexion openConnexion = new OpenConnexion();
                openConnexion.setVersionMinor(0);
                openConnexion.setVersionMajor(1);
                OpenConnexion response = (OpenConnexion) processRequest(openConnexion);
            } catch (Exception exception) {
                exception.printStackTrace();
                throw new RTIinternalError("Connection to RTIA failed. " + exception.getLocalizedMessage() + "exception was: " + exception);
            }
  4. Edit jcerti/src/certi/rti/impl/CertiRtiAmbassador.java and print the message being sent:
            CertiMessage response = null;
            synchronized(this.messageBuffer) {
                request.writeMessage(this.messageBuffer);

                System.out.println("CertiRtiAmbassador.processRequest(): sending: " + request);

                try {
                    LOGGER.info("Sending message (" + request.toString() + ")");
                    this.messageBuffer.send();
                } catch (IOException ex) {
                    LOGGER.severe("libRTI: exception: NetworkError (write)");
                    throw new RTIinternalError("libRTI: Network Write Error");
                }

                try {
                    response = MessageFactory.readMessage(messageBuffer);


                    LOGGER.info("Received message (" + response.toString() + ")\n");

                    if (request.getType() != (response.getType())) {
                        throw new RTIinternalError("RTI Ambassador Process request: request type != response type");
                    }
                } catch (IOException ex) {
                    LOGGER.severe("libRTI: exception: NetworkError (read)");
                    throw new RTIinternalError("libRTI: Network Read Error");
  5. Run ant
  6. Copy the jar file: cp ./build/jar/jcerti.jar $PTII/lib/jcerti.jar
  7. Run the model: $PTII/bin/vergil $PTII/org/hlacerti/demo/Billard/Billard.xml

It looks like this message is getting sent:

   CertiRtiAmbassador.processRequest(): sending: OPEN_CONNEXION, NO_EXCEPTION, federation time: null, versionMajor: 1, versionMinor: 0

And no message is being received:

    MessageFactory.readMessage(): certi.communication.MessageBuffer@6711fccbsize: 0

Sockets in RAW Mode?

It could be that we are opening sockets in RAW mode, which probably only works for root. It turns out that this probably not the case. I'm guessing that the issue was with the environment of my account and accidentally having a slightly different version of CERTI in my path

Can someone elaborate on the OS X 10.11 feature called 'Rootless'? says:

"The list of programs is really, really long. Anything that accesses /dev/mem or /dev/kmem or some other devices. Anything that opens sockets in RAW mode"

Possible Solution

Looking at the console and then running vergil, I saw:

  5/10/16 4:13:14.677 PM ReportCrash[2218]: Saved crash report for rtia[2217] version 0 to /Users/cxh/Library/Logs/DiagnosticReports/rtia_2016-05-10-161314_ealmac23.crash

Clicking on the report:

Process:               rtia [2217]
Path:                  /usr/local/certi-3.4.3/bin/rtia
Identifier:            rtia
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        java [2193]
Responsible:           Terminal [484]
User ID:               503

Date/Time:             2016-05-10 16:13:14.426 -0700
OS Version:            Mac OS X 10.11.4 (15E65)
Report Version:        11
Anonymous UUID:        FFB0C42D-C30C-C2CA-DBCA-5A8AE184FC69


Time Awake Since Boot: 19000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xffffffffffffffe8

VM Regions Near 0xffffffffffffffe8:
--> shared memory          00007ffffff1c000-00007ffffff1d000 [    4K] r-x/r-x SM=SHM  


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libstdc++.6.dylib                   0x000000010bef0b51 std::string::assign(char const*, unsigned long) + 23
1   rtia                                0x000000010ba1c067 PrettyDebug::setFederateName(char const*) + 41
2   rtia                                0x000000010ba1bc9c main + 219
3   libdyld.dylib                       0x00007fff91cab5ad start + 1
 

It looks like I had another copy of rtia and rtig:

bash-3.2$ which rtia
/usr/local/certi-3.4.3/bin/rtia

My solution was to remove /usr/local/certi-3.4.3

Then, the model worked as non-root!

getHostByName() returns Null

See CERTI gethostbyname

Edit - History - Print - Recent Changes - Search
Page last modified on October 20, 2017, at 09:35 AM