This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kernel0
Recipients gvanrossum, kernel0, vstinner, yselivanov
Date 2015-04-02.04:00:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427947218.56.0.749215014794.issue23846@psf.upfronthosting.co.za>
In-reply-to
Content
I tested on python3.4.2, windows 7

1. Only proactorEvent issued.
2. ThreadPoolExecutor has many workers (in the attached example file, worker count 20,000)
3. The loop does run_in_executor more call than worker count (in the attached example file, 40,000 calls)
4. After some random seconds, raise BlockingIOError

BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately.
exception calling callback for <Future at 0x1ab89ef0 state=finished returned NoneType>
Traceback (most recent call last):
  File "c:\Python342\Lib\concurrent\futures\_base.py", line 297, in _invoke_callbacks
    callback(self)
  File "c:\Python342\Lib\asyncio\futures.py", line 410, in <lambda>
    new_future._copy_state, fut))
  File "c:\Python342\Lib\asyncio\base_events.py", line 403, in call_soon_threadsafe
    self._write_to_self()
  File "c:\Python342\Lib\asyncio\proactor_events.py", line 449, in _write_to_self
    self._csock.send(b'\0')


I guess that proactor's _write_to_self method misses exception handle.

proactor_events.py
def _write_to_self(self):
        self._csock.send(b'\0')


selector_events.py
def _write_to_self(self):
        # This may be called from a different thread, possibly after
        # _close_self_pipe() has been called or even while it is
        # running.  Guard for self._csock being None or closed.  When
        # a socket is closed, send() raises OSError (with errno set to
        # EBADF, but let's not rely on the exact error code).
        csock = self._csock
        if csock is not None:
            try:
                csock.send(b'\0')
            except OSError:
                if self._debug:
                    logger.debug("Fail to write a null byte into the "
                                 "self-pipe socket",
                                 exc_info=True)


Ps: It's my first publication. Hope you understand my poor comment..
History
Date User Action Args
2015-04-02 04:00:18kernel0setrecipients: + kernel0, gvanrossum, vstinner, yselivanov
2015-04-02 04:00:18kernel0setmessageid: <1427947218.56.0.749215014794.issue23846@psf.upfronthosting.co.za>
2015-04-02 04:00:18kernel0linkissue23846 messages
2015-04-02 04:00:17kernel0create