lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
238 stars 63 forks source link

Authenticated federation is not working #1666

Closed lhstrh closed 1 year ago

lhstrh commented 1 year ago

On master, the -a flag is being ignored. In my feature branch (see #1663), this is fixed, but now it turns out that the implementation is broken. Here is a diff between the launch script generated by lfc on fed-target-conf vs. master:

# The RTI is started first to allow proper boot-up              # The RTI is started first to allow proper boot-up
# before federates will try to connect.                         # before federates will try to connect.
# The RTI will be brought back to foreground                    # The RTI will be brought back to foreground
# to be responsive to user inputs after all federates           # to be responsive to user inputs after all federates
# are launched.                                                 # are launched.
RTI -i ${FEDERATION_ID} \                                       RTI -i ${FEDERATION_ID} \
                        -a \                               <
                        -n 2 \                                                          -n 2 \
                        -c init \                                                       -c init \
exchanges-per-interval 10 \                                     exchanges-per-interval 10 \
&                                                               &
# Store the PID of the RTI                                      # Store the PID of the RTI
RTI=$!                                                          RTI=$!

I'm going to mark the tests that use authentication as "failing" so that we can move on, but this issue needs attention.

hokeun commented 1 year ago

I think this was added by Dongha. @Jakio815, can you take a look at this when you get a chance?

Jakio815 commented 1 year ago

Oops, sorry, I saw this message last time and forgot it. I'll look into this!

lhstrh commented 1 year ago

@Jakio815: any insights regarding this?

Jakio815 commented 1 year ago

I'll figure this out this weekend. Sorry for being late.

Jakio815 commented 1 year ago

I fixed the problem, but the mac CI tests are not passing yet. However it works on mac machines, so it looks like the runner environment has some problems yet. I'll fix it as soon as possible.

The error is as below.

Failed: src/federated/SimpleFederatedAuthenticated.lf
    -----------------------------------------------------------------------------
    Reason: Test timed out.
    Compilation output:
    ##### Generating code for federate fed1 in directory /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src
    ##### Generating code for federate fed2 in directory /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src
    ******** Using 2 threads to compile the program.
    Generating code for: file:/Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src/fed1.lf
    ******** mode: STANDALONE
    ******** generated sources: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1
    Generating code for: file:/Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src/fed2.lf
    ******** mode: STANDALONE
    ******** generated sources: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2
    Cleaning /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/include/src/fed2
    Cleaning /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/include/src/fed1
    --- Current working directory: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2/build
    --- Executing command: cmake -DEXECUTABLE_PREAMBLE= -DLF_REACTION_GRAPH_BREADTH=4 -DLF_THREADED=1 -DWORKERS_NEEDED_FOR_FEDERATE=2 -DNUMBER_OF_WORKERS=0 -DNUMBER_OF_FEDERATES=2 -DSCHEDULER=NP -DFEDERATED= -DFEDERATED_CENTRALIZED= -DFEDERATED_AUTHENTICATED= -DLOG_LEVEL=4 -DCMAKE_BUILD_TYPE=Test -DCMAKE_INSTALL_PREFIX=/Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated -DCMAKE_INSTALL_BINDIR=bin /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2
    --- Current working directory: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1/build
    --- Executing command: cmake -DEXECUTABLE_PREAMBLE= -DLF_REACTION_GRAPH_BREADTH=4 -DLF_THREADED=1 -DWORKERS_NEEDED_FOR_FEDERATE=2 -DNUMBER_OF_WORKERS=0 -DNUMBER_OF_FEDERATES=2 -DSCHEDULER=NP -DFEDERATED= -DFEDERATED_CENTRALIZED= -DFEDERATED_AUTHENTICATED= -DLOG_LEVEL=4 -DCMAKE_BUILD_TYPE=Test -DCMAKE_INSTALL_PREFIX=/Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated -DCMAKE_INSTALL_BINDIR=bin /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1
    -- The C compiler identification is AppleClang 14.0.0.14000029
    -- Detecting C compiler ABI info
    -- The C compiler identification is AppleClang 14.0.0.14000029
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Including sources for threaded runtime with 0 worker(s) with scheduler=NP and tracing=.
    -- Including the following sources: tag.c, port.c, mixed_radix.c, reactor_common.c, lf_token.c, clock-sync.c, federate.c, net_util.c, reactor_threaded.c, scheduler_adaptive.c, scheduler_GEDF_NP_CI.c, scheduler_GEDF_NP.c, scheduler_NP.c, scheduler_PEDF_NP.c, scheduler_sync_tag_advance.c, vector.c, pqueue.c, util.c, semaphore.c, hashset.c, hashset_itr.c, modes.c, lf_unix_clock_support.c, lf_unix_syscall_support.c, lf_linux_support.c, lf_macos_support.c, lf_windows_support.c, lf_nrf52_support.c, lf_zephyr_support.c
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    Not producing code coverage information since the selected compiler is no gcc
    CMake Deprecation Warning at CMakeLists.txt:22 (cmake_policy):
      The OLD behavior for policy CMP0023 will be removed from a future version
      of CMake.

      The cmake-policies(7) manual explains that the OLD behaviors of all
      policies are deprecated and that a policy should be set to OLD only under
      specific short-term circumstances.  Projects should be ported to the NEW
      behavior and not rely on setting a policy to OLD.

    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Including sources for threaded runtime with 0 worker(s) with scheduler=NP and tracing=.
    -- Including the following sources: tag.c, port.c, mixed_radix.c, reactor_common.c, lf_token.c, clock-sync.c, federate.c, net_util.c, reactor_threaded.c, scheduler_adaptive.c, scheduler_GEDF_NP_CI.c, scheduler_GEDF_NP.c, scheduler_NP.c, scheduler_PEDF_NP.c, scheduler_sync_tag_advance.c, vector.c, pqueue.c, util.c, semaphore.c, hashset.c, hashset_itr.c, modes.c, lf_unix_clock_support.c, lf_unix_syscall_support.c, lf_linux_support.c, lf_macos_support.c, lf_windows_support.c, lf_nrf52_support.c, lf_zephyr_support.c
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    Not producing code coverage information since the selected compiler is no gcc
    CMake Deprecation Warning at CMakeLists.txt:22 (cmake_policy):
      The OLD behavior for policy CMP0023 will be removed from a future version
      of CMake.

      The cmake-policies(7) manual explains that the OLD behaviors of all
      policies are deprecated and that a policy should be set to OLD only under
      specific short-term circumstances.  Projects should be ported to the NEW
      behavior and not rely on setting a policy to OLD.

    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE  
    -- Applying preprocessor definitions...
    -- EXECUTABLE_PREAMBLE=
    -- FEDERATED_CENTRALIZED=
    -- FEDERATED=
    -- FEDERATED_AUTHENTICATED=
    -- LF_REACTION_GRAPH_BREADTH=4
    -- LF_THREADED=1
    -- LOG_LEVEL=4
    -- NUMBER_OF_FEDERATES=2
    -- NUMBER_OF_WORKERS=0
    -- SCHEDULER=NP
    -- WORKERS_NEEDED_FOR_FEDERATE=2
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE  
    -- Applying preprocessor definitions...
    -- EXECUTABLE_PREAMBLE=
    -- FEDERATED_CENTRALIZED=
    -- FEDERATED=
    -- FEDERATED_AUTHENTICATED=
    -- LF_REACTION_GRAPH_BREADTH=4
    -- LF_THREADED=1
    -- LOG_LEVEL=4
    -- NUMBER_OF_FEDERATES=2
    -- NUMBER_OF_WORKERS=0
    -- SCHEDULER=NP
    -- WORKERS_NEEDED_FOR_FEDERATE=2
    -- Found OpenSSL: /usr/local/opt/openssl@3/lib/libcrypto.dylib (found version "3.1.0")  
    -- Configuring done (5.2s)
    -- Generating done (0.0s)
    -- Build files have been written to: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2/build
    -- Found OpenSSL: /usr/local/opt/openssl@3/lib/libcrypto.dylib (found version "3.1.0")  
    -- Configuring done (5.2s)
    -- Generating done (0.0s)
    -- Build files have been written to: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1/build
    --- Current working directory: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2/build
    --- Executing command: cmake --build . --target install --parallel 3 --config Debug
    --- Current working directory: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1/build
    --- Executing command: cmake --build . --target install --parallel 3 --config Debug
    [  2%] Building C object core/CMakeFiles/core.dir/tag.c.o
    [  5%] Building C object core/CMakeFiles/core.dir/mixed_radix.c.o
    [  8%] Building C object core/CMakeFiles/core.dir/port.c.o
    [  5%] Building C object core/CMakeFiles/core.dir/tag.c.o
    [  8%] Building C object core/CMakeFiles/core.dir/mixed_radix.c.o
    [  8%] Building C object core/CMakeFiles/core.dir/port.c.o
    [ 11%] Building C object core/CMakeFiles/core.dir/reactor_common.c.o
    [ 14%] Building C object core/CMakeFiles/core.dir/lf_token.c.o
    [ 17%] Building C object core/CMakeFiles/core.dir/federated/clock-sync.c.o
    [ 11%] Building C object core/CMakeFiles/core.dir/reactor_common.c.o
    [ 14%] Building C object core/CMakeFiles/core.dir/lf_token.c.o
    [ 17%] Building C object core/CMakeFiles/core.dir/federated/clock-sync.c.o
    [ 20%] Building C object core/CMakeFiles/core.dir/federated/federate.c.o
    [ 20%] Building C object core/CMakeFiles/core.dir/federated/federate.c.o
    [ 22%] Building C object core/CMakeFiles/core.dir/federated/net_util.c.o
    /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed1/core/federated/federate.c:65:10: fatal error: 'openssl/rand.h' file not found
    #include <openssl/rand.h> // For secure random number generation.
             ^~~~~~~~~~~~~~~~
    1 error generated.
    make[2]: *** [core/CMakeFiles/core.dir/federated/federate.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [core/CMakeFiles/core.dir/all] Error 2
    make: *** [all] Error 2
    ERROR:  failed with error code 2
    Compiled binary is in /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/bin
    [ 22%] Building C object core/CMakeFiles/core.dir/federated/net_util.c.o
    [ 25%] Building C object core/CMakeFiles/core.dir/threaded/reactor_threaded.c.o
    /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/src-gen/fed2/core/federated/federate.c:65:10: fatal error: 'openssl/rand.h' file not found
    #include <openssl/rand.h> // For secure random number generation.
             ^~~~~~~~~~~~~~~~
    1 error generated.
    make[2]: *** [core/CMakeFiles/core.dir/federated/federate.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [core/CMakeFiles/core.dir/all] Error 2
    make: *** [all] Error 2
    ERROR:  failed with error code 2
    Compiled binary is in /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/bin
    ##### Generating launcher for federation  in directory /Users/runner/work/lingua-franca/lingua-franca/test/C/bin/federated

    Execution output:
    Federate SimpleFederatedAuthenticated in Federation ID '698f29022c9f1a088a0885b3dc7743c0c[661](https://github.com/lf-lang/lingua-franca/actions/runs/4713592405/jobs/8359384103#step:7:662)a103e6bfa170'
    #### Launching the federate fed1.
    #### Launching the federate fed2.
    #### Bringing the RTI back to foreground so it can receive Control-C.
    RTI -i ${FEDERATION_ID} -a -n 2 -c init exchanges-per-interval 10
    bin/federated/SimpleFederatedAuthenticated: line 63: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/bin/fed1: No such file or directory
    bin/federated/SimpleFederatedAuthenticated: line 66: /Users/runner/work/lingua-franca/lingua-franca/test/C/fed-gen/SimpleFederatedAuthenticated/bin/fed2: No such file or directory