Skip to content

mmaping arrays fundamentally unsafe #39

Closed

Description

@jeromekelleher

mmaping provides a very fast way of accessing the arrays, but it is fundamentally unsafe without significant effort. Basically, if the underlying file is modified (truncated, say), attempts to access the corresponding pages will raise a SIGBUS.

The only way to deal with this seems to be setting a signal handler to catch this error to avoid the default abort.

Probably the only way to deal with this is to make non-mmaping the default, and to read in the arrays on demand using fread. Possibly it's best to get rid of mmap entirely here; if we don't, we need to clearly document this behaviour.

Activity

  1. jeromekelleher commented on Jun 14, 2018

    @jeromekelleher
    MemberAuthor

    Let's remove MMAP entirely. The default should be to read arrays in one-by-one using fread and mallocing memory on demand. The other option can then be to read the entire array in at once.

    MMAP isn't worth the complexity.

  2. jeromekelleher commented on Jun 16, 2018

    @jeromekelleher
    MemberAuthor

    Also note here, the __unix__ checks don't work on OSX.

  3. added this to the Version 0.2.1 milestone on Dec 5, 2018
  4. jeromekelleher commented on Dec 7, 2018

    @jeromekelleher
    MemberAuthor

    Partially resolved in #57 where we get rid of mmap from the API and also the C implementation. We can fix the Python implementation later in #58.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions