classification
Title: multiprocessing BaseManager serve_client() does not check EINTR on recv
Type: behavior Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lvroyce, python-dev, sbt
Priority: normal Keywords:

Created on 2013-02-01 10:43 by lvroyce, last changed 2013-07-01 19:35 by sbt. This issue is now closed.

Files
File name Uploaded Description Edit
fakesupervdsm.py lvroyce, 2013-02-01 10:43 EINTR-baseManager
Messages (2)
msg181074 - (view) Author: lvroyce (lvroyce) Date: 2013-02-01 10:43
We create our customised manager which will fork child process with baseManager. Because we registered SIGCHLD to reap the zombie for manager, we found this causes baseManager raise RemoteError when called twice.(Test script attached.)

After look at baseManager.py we found recv() in handling the request has been interrupted by comming SIGCHLD, not retry recv(), but raise to client side directly.
try:

                methodname = obj = None

                request = recv()<------------------this line been interrupted by SIGCHLD

                ident, methodname, args, kwds = request

                obj, exposed, gettypeid = id_to_obj[ident]

                if methodname not in exposed:

                    raise AttributeError(

                        'method %r of %r object is not in exposed=%r' %

                        (methodname, type(obj), exposed)

                        )

                function = getattr(obj, methodname)
                try:

                    res = function(*args, **kwds)

                except Exception, e:

                    msg = ('#ERROR', e)

                else:

                    typeid = gettypeid and gettypeid.get(methodname, None)

                    if typeid:

                        rident, rexposed = self.create(conn, typeid, res)

                        token = Token(typeid, self.address, rident)

                        msg = ('#PROXY', (rexposed, token))

                    else:

                        msg = ('#RETURN', res)
            except AttributeError:
                if methodname is None:
                    msg = ('#TRACEBACK', format_exc())
                else:
                    try:
                        fallback_func = self.fallback_mapping[methodname]
                        result = fallback_func(
                            self, conn, ident, obj, *args, **kwds
                            )
                        msg = ('#RETURN', result)
                    except Exception:
                        msg = ('#TRACEBACK', format_exc())

            except EOFError:
                util.debug('got EOF -- exiting thread serving %r',
                           threading.current_thread().name)
                sys.exit(0)

            except Exception:<------does not handle IOError,INTR here should retry recv() 
                msg = ('#TRACEBACK', format_exc())
msg192145 - (view) Author: Roundup Robot (python-dev) Date: 2013-07-01 18:12
New changeset bc34fe4a0d58 by Richard Oudkerk in branch '2.7':
Issue #17097: Make multiprocessing ignore EINTR.
http://hg.python.org/cpython/rev/bc34fe4a0d58

New changeset 3ec5267f51ff by Richard Oudkerk in branch '3.3':
Issue #17097: Make multiprocessing ignore EINTR.
http://hg.python.org/cpython/rev/3ec5267f51ff

New changeset 035577781505 by Richard Oudkerk in branch 'default':
Issue #17097: Merge.
http://hg.python.org/cpython/rev/035577781505
History
Date User Action Args
2013-07-01 19:35:57sbtsetstatus: open -> closed
resolution: fixed
stage: resolved
2013-07-01 18:12:09python-devsetnosy: + python-dev
messages: + msg192145
2013-02-02 06:08:46gregory.p.smithsettitle: baseManager serve_client() not check EINTR when recv request -> multiprocessing BaseManager serve_client() does not check EINTR on recv
2013-02-01 13:10:42sbtsetnosy: + sbt
2013-02-01 10:43:44lvroycecreate