Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payload size not updated by allocateChunk(WithInfo) #10

Closed
rex-schilasky opened this issue Nov 12, 2019 · 2 comments · Fixed by #11
Closed

Payload size not updated by allocateChunk(WithInfo) #10

rex-schilasky opened this issue Nov 12, 2019 · 2 comments · Fixed by #11
Assignees
Labels
bug Something isn't working

Comments

@rex-schilasky
Copy link

rex-schilasky commented Nov 12, 2019

Required information

Operating system:
Ubuntu 18.04 LTS

Compiler version:
GCC 7.4.0

Observed result or behaviour:
When allocating a chunk with allocateChunk or allocateChunkWithInfo using the dynamic payload option (useDynamicPayloadSizes = true) the ChunkInfo field m_payloadSize is initialized correctly by the first call. Subsequent calls of the same function with an increased payloadSize do not update the member variable.

Expected result or behaviour:
ChunkInfo::m_payloadSize should reflect the current payload size under all conditions.

Conditions where it occurred / Performed steps:

// publisher side
auto ci = m_publisher->allocateChunkWithInfo(42, true);
m_publisher->sendChunkWithInfo(ci);

auto ci = m_publisher->allocateChunkWithInfo(42+1, true);
m_publisher->sendChunkWithInfo(ci);

...

// subscriber side
const iox::mepoo::ChunkInfo* ci(nullptr);
while (m_subscriber->getChunkWithInfo(&ci))
{
  std::cout << ci->m_payloadSize << std::endl;
  m_subscriber->releaseChunkWithInfo(ci);
}
@budrus
Copy link
Contributor

budrus commented Nov 13, 2019

Thanks @rex-schilasky. We have an optimization to recycle the last chunk that was sent if this one is free again. As we don't create a new chunk it is not initialized again. So we must check if the old chunk can really be used again and update its payload size

@mossmaurice mossmaurice self-assigned this Nov 13, 2019
@mossmaurice mossmaurice added the bug Something isn't working label Nov 21, 2019
mossmaurice added a commit to mossmaurice/iceoryx that referenced this issue Nov 21, 2019
…hunk and add new tests

Signed-off-by: Hoinkis Simon (CC-AD/ESW1) <simon.hoinkis2@de.bosch.com>
mossmaurice added a commit to mossmaurice/iceoryx that referenced this issue Nov 21, 2019
Signed-off-by: Hoinkis Simon (CC-AD/ESW1) <simon.hoinkis2@de.bosch.com>
mossmaurice added a commit that referenced this issue Dec 3, 2019
…nment-when-reusing-last-chunk

IOX #10 Fix payloadsize assignment when reusing last chunk
@rex-schilasky
Copy link
Author

Thank you for fixing that !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants