Skip to content

ipc_*: In native calls, handle interruption via signal <=> EINTR. #163

Open

Description

@ygoldfeld

This is related to #88. Suggest tackling them at the same time.

we call a native thing, especially things that one naively might assume are non-blocking and do not EINTR, and that thing emits EINTR: what do we do? Should we retry (probably, if it's a naively non-blocking call particularly)?

I'll leave the full investigating until the actual fix attempt.

Random notes

That said I do want to point out that, specifically, the recently-added Sparse_shm stuff in shm::bipc_ext, which extends some central bipc.shm classes (shared_memory_object, basic_managed_shared_memory) invoke things natively, as bipc.shm does, and those things "feel" like they won't EINTR, but they can in some cases.

  • ::fallocate() (in Sparse_* commit()) can actually EINTR. It goes through potentially many pages, and for huge pool-sizes that can take seconds. What to do? Pretty good question actually. Retry seems right; if we are not OK with commit() taking seconds (I think we pretty have to be), then that is orthogonal to EINTR handling. If we don't like that, then we'd need to add other code to somehow stop in media res, if it's taking too long. (Let'sn't, I think.) / Correction: we already do it (retry).
  • ::shm_open() (sorry... not in SHM-classic/Sparse_*... but SHM-jemalloc code does it, as its author preferred not to go through bipc.shm): man in Linux does not list EINTR that I can see; POSIX allows it allegedly though. Possibly handle it just in case.
  • ftruncate(): man in Linux lists EINTR. This might not be actually possible. Possibly handle it just in case, as I believe Boost-1.87+ does. / Correction: we already do it.

So apparently nothing to do in Sparse_* land, but the SHM-jemalloc note does somewhat apply. Anyway! The full investigating => later.

Activity

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

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions