RustDDS
RustDDS copied to clipboard
DataWriter failed: OutOfResources
I am writing some code from the shape example. Basically, I have a component that uses DDS on behalf of internal apps and other components. So I have created one writer and one reader for each topic, and placed them behind
writers: HashMap<usize, Arc<Mutex<DataWriter<Message>>>>,
readers: HashMap<usize, Arc<Mutex<DataReader<Message>>>>,
as different threads will have access to.
I am using exactly the same structure of the Shape example, except that now every topic has one reader and one writer. Hence, if one wants to write to a topic, needs to get the writer of that topic, lock on it via the Mutex and proceed with writing. It seems quite natural to me, until I get OutOfResources error like the following, every time I try to write to a topic (which exists and which has a (writer,reader) pair.
2022-06-10T10:36:09.343323456+02:00 ERROR dds - DataWriter write failed: OutOfResources
2022-06-10T10:36:09.343440454+02:00 DEBUG dds - interacting with DDS
2022-06-10T10:36:09.843957986+02:00 WARN rustdds::dds::with_key::datawriter - Failed to write new data: topic="heartbeat" reason=Disconnected timeout=None
Please submit a minimal buildable code that reproduces the error.
Please submit a minimal buildable code that reproduces the error.
https://pastebin.com/X5CZebK0
Basically, I wrap a DDSInner
into a DDS
struct that i can initialize with new()
and loop over with run()
.
(code is not really minimal but it reproduces the issue)
Error at runtime is:
[dds/src/lib.rs:618] "Writing message to topic {} " = "Writing message to topic {} "
[dds/src/lib.rs:618] &topic_name = "one"
2022-06-30T07:28:36.462127138+02:00 WARN rustdds::dds::with_key::datawriter - Failed to write new data: topic="one" reason=Disconnected timeout=None