Skip to content

multiprocessing.util._eintr_retry doen't recalculate timeouts #56547

Closed

Description

@sbt
mannequin
BPO 12338
Nosy @pitrou, @vstinner
Files
  • mp_remove_eintr_retry.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-05-25.20:15:26.574>
    created_at = <Date 2011-06-15.13:24:28.294>
    labels = ['type-bug']
    title = "multiprocessing.util._eintr_retry doen't recalculate timeouts"
    updated_at = <Date 2012-05-25.20:15:26.572>
    user = 'https://bugs.python.org/sbt'

    bugs.python.org fields:

    activity = <Date 2012-05-25.20:15:26.572>
    actor = 'sbt'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-05-25.20:15:26.574>
    closer = 'sbt'
    components = []
    creation = <Date 2011-06-15.13:24:28.294>
    creator = 'sbt'
    dependencies = []
    files = ['24888']
    hgrepos = []
    issue_num = 12338
    keywords = ['patch']
    message_count = 8.0
    messages = ['138364', '138674', '156035', '156088', '157819', '157820', '157821', '161619']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'vstinner', 'sbt']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue12338'
    versions = ['Python 3.3']

    Activity

    1. sbt commented on Jun 15, 2011

      sbtmannequin
      MannequinAuthor

      multiprocessing.util._eintr_retry is only used to wrap select.select, but it fails to recalculate timeouts.

      Also, it will never retry the function it wraps because of a missing "import errno".

      I think it would be better to just implement the retrying version of select directly.

    2. vstinner commented on Jun 19, 2011

      @vstinner
      Member

      subprocess._communicate_with_select() retries select.select() on EINTR: it recomputes timeout before each call.

      while self._read_set or self._write_set:
          timeout = self._remaining_time(endtime)
          if timeout is not None and timeout < 0:
              raise TimeoutExpired(self.args, orig_timeout)
          try:
              (rlist, wlist, xlist) = \
                  select.select(self._read_set, self._write_set, [],
                                timeout)
          except select.error as e:
              if e.args[0] == errno.EINTR:
                  continue
              raise
          ...

      It has a similar code for select.poll().

      asyncore.poll() handles EINTR: it just returns.

      I think it would be better to just implement the retrying version
      of select directly.

      It would be nice to share more code between subprocess and multiprocessing, but I don't know where such code should be moved. Create a new module just for one function is stupid. Handling EINTR is a common problem when managing subprocesses.

      subprocess has a _eintr_retry_call() function.

      multiprocessing has a @_eintr_retry decorator handling supporting more error types (use except (EnvironmentError, select.error):).

    3. sbt commented on Mar 16, 2012

      sbtmannequin
      MannequinAuthor

      _eintr_retry is currently unused. The attached patch removes it.

      If it is retained then we should at least add a warning that it does not recalculate timeouts.

    4. pitrou commented on Mar 16, 2012

      @pitrou
      Member

      _eintr_retry is currently unused.

      AFAICT it's still used in forking.py.

    5. vstinner commented on Apr 8, 2012

      @vstinner
      Member

      SocketServer has been changed to restart select() on EINTR, but it doesn't recompute the timeout.

    6. vstinner commented on Apr 8, 2012

      @vstinner
      Member

      SocketServer has been changed to restart select() on EINTR,
      but it doesn't recompute the timeout.

      See issue bpo-7978.

    7. pitrou commented on Apr 8, 2012

      @pitrou
      Member

      Note that socketserver's timeout is not really important: it's just used for a polling loop, with a default of 0.5 seconds.

    8. sbt commented on May 25, 2012

      sbtmannequin
      MannequinAuthor

      _eintr_retry was removed by 99ef4501205b.

    9. added
      type-bugAn unexpected behavior, bug, or error
      on May 25, 2012
    10. transferred this issue fromon Apr 10, 2022
    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

      type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions