Skip to content

Make C++ Arrow serialization deterministic #15367

Closed

Description

@asfimport

In C++ arrow it can currently occur that uninitialized data created by the builders is written to IPC memory. The goal of this issue is to identify these cases and set the memory to zero.

Note that most of these cases have already been identified by valgrind and fixed in the past.

Some of the considerations and benefits are discussed in this github PR:
#397

Reporter: Philipp Moritz / @pcmoritz
Assignee: Philipp Moritz / @pcmoritz

Note: This issue was originally created as ARROW-664. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Wes McKinney / @wesm:
    @pcmoritz independent of the discussion about the standard memory format in the linked PR, I agree that we have an option (perhaps the default and only option) to always zero out memory in the C++ implementation.

    From a quick scan of the array builders, it appears we are not zeroing the memory for the offsets in ListBuilder::Resize. I don't see anything else at a glance. Seems like this should be reproducible in a test case that fails with some probability (deterministic failure might be difficult because it's UB).

  2. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Wes McKinney / @wesm:
    To fix this, I recommend adding an option to arrow::BufferBuilder at https://github.com/apache/arrow/blob/master/cpp/src/arrow/buffer.h#L163.

  3. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Philipp Moritz / @pcmoritz:
    Thanks @wesm, I created a PR #405

    I made zero-initialization the default (it also seems to be the default for the other builders), let me know if you prefer it to be optional. Is there a reason why it is not already done?

  4. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Wes McKinney / @wesm:
    No, it is simply an oversight. Since we run the unit test suite with valgrind we would have seen this if we had any test cases which examine the padding region.

  5. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Philipp Moritz / @pcmoritz:
    Thanks, that makes sense! As a result of the PR, the Ray determinism test pass on the latest Arrow version. So the subset of Arrow we are using seems to be deterministic now.

  6. asfimport commented on Mar 20, 2017

    @asfimport
    Author

    Uwe Korn / @xhochy:
    Issue resolved by pull request 405
    #405

  7. added this to the 0.3.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions