roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.03k stars 205 forks source link

Problems with netio and public_api tests when running without Internet #567

Open gavv opened 9 months ago

gavv commented 9 months ago

When network interfaces are up, but there is no Internet connection, one test in roc-test-netio hangs for a while. However after a while all tests pass.

When all network interfaces, except loopback, are down, some tests in roc-test-netio and roc-test-public-api fail:

$ ./bin/x86_64-pc-linux-gnu/roc-test-netio   
...
src/tests/roc_netio/test_udp_ports.cpp:203: error: Failure in TEST(udp_ports, add_multicast_receiver)
    CHECK(add_udp_receiver(net_loop, rx_config, queue)) failed

........................................
Errors (1 failures, 43 tests, 43 ran, 21768 checks, 0 ignored, 0 filtered out, 66 ms)
$ ./bin/x86_64-pc-linux-gnu/roc-test-public-api                        
..................................................
........
src/tests/public_api/test_receiver.cpp:252: error: Failure in TEST(receiver, configure_error)
    CHECK(roc_receiver_bind(receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_SOURCE, source_endpoint) == 0) failed

src/tests/public_api/test_receiver.cpp:221: error: Failure in TEST(receiver, configure_error)
src/tests/public_api/test_receiver.cpp:39: error:
    LONGS_EQUAL(0, roc_context_close(context)) failed
    expected < 0 (0x0)>
    but was  <-1 (0xffffffffffffffff)>

...
src/tests/public_api/test_receiver.cpp:151: error: Failure in TEST(receiver, configure)
    CHECK(roc_receiver_bind(receiver, ROC_SLOT_DEFAULT, ROC_INTERFACE_AUDIO_SOURCE, source_endpoint) == 0) failed

src/tests/public_api/test_receiver.cpp:128: error: Failure in TEST(receiver, configure)
src/tests/public_api/test_receiver.cpp:39: error:
    LONGS_EQUAL(0, roc_context_close(context)) failed
    expected < 0 (0x0)>
    but was  <-1 (0xffffffffffffffff)>

......................
Errors (4 failures, 83 tests, 83 ran, 20871 checks, 0 ignored, 0 filtered out, 1484 ms)

(tested on Linux)

We need to investigate the reason and if possible, make tests passing without delays when there is no Internet.

Note: use -v option to enable logs in tests.

gavv commented 8 months ago

Another log: https://github.com/roc-streaming/roc-toolkit/issues/624#issue-1971397405

If no network interface is up except localhost on Ubuntu 20.04, the test udp_ports::add_multicast_receiver fails:

23:28:17.439 [1513444] [err] roc_netio: [udp_receiver_port.cpp:311] udp receiver: <udprecv 0x7ffff00022f8 bind=224.0.0.1:0>: uv_udp_set_membership(): [ENODEV] no such device
23:28:17.439 [1513444] [err] roc_netio: [network_loop.cpp:404] network loop: can't add udp receiver port 224.0.0.1:0: can't start udp receiver
23:28:17.439 [1513444] [dbg] roc_netio: [udp_receiver_port.cpp:137] udp receiver: <udprecv 0x7ffff00022f8 bind=224.0.0.1:0>: initiating asynchronous close
23:28:17.439 [1513444] [dbg] roc_netio: [udp_receiver_port.cpp:165] udp receiver: <udprecv 0x7ffff00022f8 bind=224.0.0.1:0>: closed port
23:28:17.440 [1513444] [dbg] roc_netio: [network_loop.cpp:263] network loop: asynchronous close finished: port <udprecv 0x7ffff00022f8 bind=224.0.0.1:0>