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

DpContainer does not reset serialization on assignment. #2938

Open
timcanham opened this issue Oct 10, 2024 · 2 comments
Open

DpContainer does not reset serialization on assignment. #2938

timcanham opened this issue Oct 10, 2024 · 2 comments
Assignees
Labels

Comments

@timcanham
Copy link
Collaborator

F´ Version v3.4.3
Affected Component n/a

Problem Description

When a new buffer is assigned to a DpContainer, the serialization pointer is not reset.

Context / Environment

Execute fprime-util version-check and share the output.

Operating System: Linux
CPU Architecture: x86_64
Platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python version: 3.10.12
CMake version: 3.30.2
Pip version: 22.0.2
Pip packages:
    fprime-tools==3.4.4
    fprime-gds==3.4.4a3
    fprime-fpp-*==2.2.0a1

How to Reproduce

  1. Fill a container with data products and write
  2. Ask DpManager for another buffer
  3. Underlying DpContainer does not reset serialization
  4. Adding records picks up at old serialization point

I manually added a reset of the serialization to DpContainer:

void DpContainer::setBuffer(const Buffer& buffer) {
    // Set the buffer
    this->m_buffer = buffer;
    // Check that the buffer is large enough to hold a data product packet with
    // zero-size data
    const FwSizeType bufferSize = buffer.getSize();
    FW_ASSERT(bufferSize >= MIN_PACKET_SIZE, static_cast<FwAssertArgType>(bufferSize),
              static_cast<FwAssertArgType>(MIN_PACKET_SIZE));
    // Initialize the data buffer
    U8* const buffAddr = buffer.getData();
    const FwSizeType dataCapacity = buffer.getSize() - MIN_PACKET_SIZE;
    // Check that data buffer is in bounds for packet buffer
    const FwSizeType minBufferSize = DATA_OFFSET + dataCapacity;
    FW_ASSERT(bufferSize >= minBufferSize, static_cast<FwAssertArgType>(bufferSize),
              static_cast<FwAssertArgType>(minBufferSize));
    U8* const dataAddr = &buffAddr[DATA_OFFSET];
    this->m_dataBuffer.setExtBuffer(dataAddr, static_cast<Fw::Serializable::SizeType>(dataCapacity));
    // reset the serialization
    this->m_dataBuffer.resetSer();
}

However, when adding new records, eventually the container asserts:

EVENT: (8450) (2:1728529763,447710) ACTIVITY_LO: (SG1) DpComplete : Writing 15 DP records 780 bytes total
Assert: "/home/tcanham/source/fprime/Fw/Dp/DpContainer.cpp:201" 1463 907
FATAL 16898 handled.
Exiting with abort signal and core dump file.
Aborted

Expected Behavior

The container should be completely reset.

@bocchino
Copy link
Collaborator

I'm working on some fixes to F Prime that should address the immediate issue. I opened up a related issue in nasa/fpp to ensure that all the state (not just the serialization state) is reset when doing a DpGet operation.

@bocchino
Copy link
Collaborator

@timcanham Can you check whether #2941 successfully addresses this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants