eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.68k stars 393 forks source link

RouDi-GTest Multithread Integration Test #2194

Closed geke-mir closed 9 months ago

geke-mir commented 9 months ago

Required information

Operating system: Ubuntu 22.04.2 LTS

Compiler version: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Eclipse iceoryx version: v2.90.0-1273-g9e795aac7

Observed result or behaviour: A follow up to #2186 - I was able to use the RouDi_GTest class to make a fixture to test parts of my application, but when performing an integration, test I get the following error:

Condition: !invalidGetRuntimeAccess in static iox::runtime::PoshRuntime& iox::roudi::RuntimeTestInterface::runtimeFactoryGetInstance(iox::optional<const iox::string<100>*>) is violated. (/iceoryx/iceoryx_posh/testing/roudi_environment/runtime_test_interface.cpp:104)

The test runs the system in a thread, leaving the main thread to exercise functionality by sending client requests. This error occurs when the system, running in a separate thread, attempts to create a class that has a Subscriber member. My guess is that when creating the subscriber, there is no active runtime in this thread, so the system crashes?

I guess my main question is - do you have to initialize a Runtime for each thread in an application?

elBoberido commented 9 months ago

@geke-mir yes, you indeed have to initialize one runtime per thread. The RouDi environment was created for integration tests and one thread represents one process.