aws-samples / aws-iot-securetunneling-localproxy

AWS Iot Secure Tunneling local proxy reference C++ implementation
https://docs.aws.amazon.com/iot/latest/developerguide/what-is-secure-tunneling.html
Apache License 2.0
74 stars 71 forks source link

localproxytest fails in [source] tests when simulating source app connects to source local proxy #38

Closed RobertWCarey closed 3 years ago

RobertWCarey commented 3 years ago

I am trying to run the localproxytest on a iMX6ULL (ARM Cortex A7) chip. The [config] and [destination] tests appear to be passing but it ends up in an endless loop when client_socket.connect(tcp::endpoint{boost::asio::ip::make_address(adapter_cfg.bind_address.get()), adapter_chosen_port} ); is called in AdapterTests.cpp line 236 for the [source] tests.

It seems like it is trying to connect to a local websocket but is never able to? See the log below.

Note I also increased IO_PAUSE_MS to 100 as I was having intermittent faults. See localproxytest fails intermittently?

/home/build/SWDev/3-1229_AWS/buildroot/output/build/aws-iot-securetunneling-localproxy-8980ea8e0190c7e8fd942f2bce8bfc01aa6a6a52/test/AdapterTests.cpp:223: PASSED:
  CHECK( ws_server.get_handshake_request().base()["access-token"] == adapter_cfg.access_token )
with expansion:
  foobar_token == "foobar_token"

[2021-02-17 22:10:26.928771] [0x7620e3b0] [debug]   No serviceId_to_tcp_server mapping for service_id: 
[2021-02-17 22:10:26.928853] [0x7620e3b0] [debug]   Extracting service Ids from control message 5
[2021-02-17 22:10:26.928902] [0x7620e3b0] [trace]   Service id received: 
[2021-02-17 22:10:26.928935] [0x7620e3b0] [trace]   ssh1
[2021-02-17 22:10:26.928968] [0x7620e3b0] [trace]   Validating service ids configuration
[2021-02-17 22:10:26.929004] [0x7620e3b0] [trace]   Setting up tcp sockets 
[2021-02-17 22:10:26.929033] [0x7620e3b0] [trace]   Clearing all ws data buffers
[2021-02-17 22:10:26.929062] [0x7620e3b0] [trace]   Finished Clearing all ws data buffers
[2021-02-17 22:10:26.929092] [0x7620e3b0] [trace]   Initializing tcp servers ...
[2021-02-17 22:10:26.929217] [0x7620e3b0] [trace]   Setting up source tcp sockets
[2021-02-17 22:10:26.929254] [0x7620e3b0] [trace]   Setting up tcp socket for service id: ssh1
[2021-02-17 22:10:26.929375] [0x7620e3b0] [debug]   Resolving bind address host: 127.0.0.1
[2021-02-17 22:10:26.929482] [0x7620e3b0] [debug]   Port to connect 39367
[2021-02-17 22:10:26.929693] [0x7620e3b0] [debug]   Starting web socket read loop continue reading...
[2021-02-17 22:10:26.929837] [0x7620e3b0] [debug]   Resolved bind IP: 127.0.0.1
[2021-02-17 22:10:26.930007] [0x7620e3b0] [info]    Listening for new connection on port 39367
[2021-02-17 22:10:31.848730] [0x7620e3b0] [trace]   Sent ping data: 1613599831848
[2021-02-17 22:10:31.849691] [0x7620e3b0] [trace]   Pong reply latency: 1 ms
[2021-02-17 22:10:36.849340] [0x7620e3b0] [trace]   Sent ping data: 1613599836849
[2021-02-17 22:10:36.850272] [0x7620e3b0] [trace]   Pong reply latency: 1 ms
[2021-02-17 22:10:41.849943] [0x7620e3b0] [trace]   Sent ping data: 1613599841849
[2021-02-17 22:10:41.850895] [0x7620e3b0] [trace]   Pong reply latency: 1 ms
[2021-02-17 22:10:46.850555] [0x7620e3b0] [trace]   Sent ping data: 1613599846850
[2021-02-17 22:10:46.851508] [0x7620e3b0] [trace]   Pong reply latency: 1 ms
/home/build/SWDev/3-1229_AWS/buildroot/output/build/aws-iot-securetunneling-localproxy-8980ea8e0190c7e8fd942f2bce8bfc01aa6a6a52/test/AdapterTests.cpp:223: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGINT - Terminal interrupt signal

===============================================================================
test cases:  2 |  1 passed | 1 failed
assertions: 43 | 42 passed | 1 failed
MiaoZhangAWS commented 3 years ago

Thanks for contacting us regarding this issue. From the logs provided, the test case is failing when try to connect to the TCP port 39367. The test case tagged with [source] is targeted to do sanity check for local proxy running in source mode. In this case, it will randomly select an available port and connect to it (act as your application on source device). Looks like it failed at the step trying to connect to this assigned port. Some questions to clarify:

RobertWCarey commented 3 years ago

I doubled checked and we are only going to be running local proxy in destination mode so I will just leave the source mode for now.

I did check if the port was being used by anything else and it wasn't. I also tried changing to a different port but got the same result.

Thanks for your help.