eclipse-iceoryx / iceoryx

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

Meet error: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL #2358

Closed jerry-xie-000 closed 1 month ago

jerry-xie-000 commented 1 month ago

The variable g_data_size for publisher loan size should be modified each time, maybe 200, 2000,20000,200000, 200, 2000...

    iox::popo::UntypedPublisher publisher({"adc", "data", "Object"});

while(true)
{
   publisher.loan(g_data_size))
              .and_then([&](auto& userPayload) {   ...   }
}

After changing many times with different loan data size , these errors will be shown:

Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL
Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL
Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL
Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL
Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL

Is my usage wrong? We need to change loan data size in different situation.

elfenpiff commented 1 month ago

@jerry-xie-000 are you sending the message with publisher.publish()? or releasing it in any other way?

jerry-xie-000 commented 1 month ago

Yes, I sending the message with publisher.publish()

  iox::popo::UntypedPublisher publisher({"adc", "data", "Object"});

while(true)
{
   publisher.loan(g_data_size))
              .and_then([&](auto& userPayload) {  
                    ... 
                publisher.publish(userPayload);
                          }
}

I just run the publisher application, and doesn't run the subscriber.

I try to just change the size with two different size alternately, the errors can be reproduced.

elfenpiff commented 1 month ago

@jerry-xie-000 The error message Unable to loan sample, error code: AllocationError::TOO_MANY_CHUNKS_ALLOCATED_IN_PARALLEL should only come when you loan messages on the publisher side and never release them. But since you call Publisher::publish() which releases them, it should not occur. Do you store some of the samples and do not publish them?

@elBoberido do you have any ideas here?

jerry-xie-000 commented 1 month ago

No, I just loan() and publish() each time, do not store any samples. If not change the loan size, the publisher can publish well, 60 times per second.

jerry-xie-000 commented 1 month ago

Sorry, it's my mistake. There is one code to return the function before Publisher::publish().