summaryrefslogtreecommitdiff
path: root/asyncio/windows_events.py
Commit message (Collapse)AuthorAgeFilesLines
* Python issue #23095: Rewrite _WaitHandleFuture.cancel()Victor Stinner2015-01-211-34/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes a race conditon related to _WaitHandleFuture.cancel() leading to Python crash or "GetQueuedCompletionStatus() returned an unexpected event" logs. Before, the overlapped object was destroyed too early, it was possible that the wait completed whereas the overlapped object was already destroyed. Sometimes, a different overlapped was allocated at the same address, leading to unexpected completition. _WaitHandleFuture.cancel() now waits until the wait is cancelled to clear its reference to the overlapped object. To wait until the cancellation is done, UnregisterWaitEx() is used with an event instead of UnregisterWait(). To wait for this event, a new _WaitCancelFuture class was added. It's a simplified version of _WaitCancelFuture. For example, its cancel() method calls UnregisterWait(), not UnregisterWaitEx(). _WaitCancelFuture should not be cancelled. The overlapped object is kept alive in _WaitHandleFuture until the wait is unregistered. Other changes: * Add _overlapped.UnregisterWaitEx() * Remove fast-path in IocpProactor.wait_for_handle() to immediatly set the result if the wait already completed. I'm not sure that it's safe to call immediatly UnregisterWaitEx() before the completion was signaled. * Add IocpProactor._unregistered() to forget an overlapped which may never be signaled, but may be signaled for the next loop iteration. It avoids to block forever IocpProactor.close() if a wait was cancelled, and it may also avoid some "... unexpected event ..." warnings.
* Close the transport on subprocess creation failureVictor Stinner2015-01-151-1/+6
|
* Truncate to 80 columnsVictor Stinner2015-01-091-1/+2
|
* IocpProactor.wait_for_handle() test now also checks the result of the futureVictor Stinner2014-12-191-0/+5
|
* Fix typoVictor Stinner2014-12-181-1/+1
|
* Tulip issue #200: Log errors in debug mode instead of simply ignoring them.Victor Stinner2014-08-251-0/+3
|
* Tulip issue #200: _WaitHandleFuture._unregister_wait() now catchs and logsVictor Stinner2014-08-251-3/+10
| | | | exceptions.
* PipeServer.close() now cancels the "accept pipe" future which cancels theVictor Stinner2014-07-301-3/+12
| | | | overlapped operation.
* _WaitHandleFuture.cancel() now notify IocpProactor through the overlappedVictor Stinner2014-07-291-3/+13
| | | | object that the wait was cancelled.
* Optimize IocpProactor.wait_for_handle() gets the result if the wait is signaledVictor Stinner2014-07-291-6/+20
| | | | immediatly.
* Fix repr(_WaitHandleFuture)Victor Stinner2014-07-291-1/+1
|
* _WaitHandleFuture and _OverlappedFuture: hide frames of internal calls in theVictor Stinner2014-07-291-0/+6
| | | | source traceback.
* Enhance representation of Future and Future subclassesVictor Stinner2014-07-291-17/+10
| | | | | | | | | | * Add "created at filename:lineno" in the representation * Add Future._repr_info() method which can be more easily overriden than Future.__repr__(). It should now be more easy to enhance Future representation without having to modify each subclass. For example, _OverlappedFuture and _WaitHandleFuture get the new "created at" information. * Use reprlib to format Future result, and function arguments when formatting a callback, to limit the length of the representation.
* Cleanup ProactorIocp._poll(): set the timeout to 0 after the first call toVictor Stinner2014-07-291-2/+3
| | | | GetQueuedCompletionStatus()
* Tulip issue 196: ProactorIocp._register() now registers the overlapped in theVictor Stinner2014-07-261-15/+38
| | | | | | | | | | | | | | | | _cache dictionary, even if we already got the result. We need to keep a reference to the overlapped object, otherwise the memory may be reused and GetQueuedCompletionStatus() may use random bytes and behaves badly. There is still a hack for ConnectNamedPipe(): the overlapped object is not register into _cache if the overlapped object completed directly. Log also an error in debug mode in ProactorIocp._loop() if we get an unexpected event. Add a protection in ProactorIocp.close() to avoid blocking, even if it should not happen. I still don't understand exactly why some the completion of some overlapped objects are not notified.
* Tulip issue #196: _OverlappedFuture.set_result() now clears its reference toVictor Stinner2014-07-261-5/+11
| | | | | the overlapped object. IocpProactor._poll() now also ignores false alarms: GetQueuedCompletionStatus() returns the overlapped but it is still pending.
* Oops, fix previous commit: I wanted to do exactly the reverse: only clear theVictor Stinner2014-07-251-5/+5
| | | | reference in _poll(), not in _register().
* Tulip issue #196: IocpProactor._poll() clears the reference to theVictor Stinner2014-07-251-0/+5
| | | | | | | | overlapped operation when the operation is done. It would be better to clear the reference in a new _OverlappedFuture.set_result() method, but it cannot be done yet because of a weird bug.
* _OverlappedFuture.set_exception() now cancels the overlapped operation.Victor Stinner2014-07-251-0/+4
|
* _WaitHandleFuture now unregisters its wait handler if WaitForSingleObject()Victor Stinner2014-07-251-3/+4
| | | | raises an exception.
* Check if _WaitHandleFuture completed before unregistering it in the callback.Victor Stinner2014-07-251-5/+23
| | | | Add also _WaitHandleFuture._poll() and repr(_WaitHandleFuture).
* _OverlappedFuture.cancel() now clears its reference to the overlapped objectVictor Stinner2014-07-251-15/+21
| | | | Make also the _OverlappedFuture.ov attribute private.
* Fix _WaitHandleFuture.cancel(): return the result of the parent cancel() methodVictor Stinner2014-07-251-1/+1
|
* IocpProactor.close(): cancel futures to cancel overlapped operations, insteadVictor Stinner2014-07-251-4/+12
| | | | | | | | | | of cancelling directly overlapped operations. Future objects may not call ov.cancel() if the future was cancelled or if the overlapped was already cancelled. The cancel() method of the future may also catch exceptions. Log also errors on cancellation.
* Tulip issue #195: Don't call UnregisterWait() twice if a _WaitHandleFuture isVictor Stinner2014-07-251-8/+10
| | | | cancelled twice to fix a crash.
* Add a __repr__() method to IocpProactorVictor Stinner2014-07-251-0/+5
|
* Add a destructor to IocpProactor which closes itVictor Stinner2014-07-251-0/+3
|
* _OverlappedFuture.cancel() doesn't cancel the overlapped anymore if it is done:Victor Stinner2014-07-251-4/+12
| | | | | | if it is already cancelled or completed. Log also an error if the cancellation failed.
* Add the address of the overlapped object in repr(_OverlappedFuture)Victor Stinner2014-07-251-4/+2
|
* _OverlappedFuture truncates the source traceback to hide the call to the parentVictor Stinner2014-07-251-0/+2
| | | | constructor (useless in debug).
* Tulip issue #183: log socket events in debug modeVictor Stinner2014-07-121-0/+12
| | | | | | | | | | - Log most important socket events: socket connected, new client, connection reset or closed by peer (EOF), etc. - Log time elapsed in DNS resolution (getaddrinfo) - Log pause/resume reading - Log time of SSL handshake - Log SSL handshake errors - Add a __repr__() method to many classes
* Move coroutine code in the new module asyncio.coroutinesVictor Stinner2014-06-291-5/+6
|
* windows_events.py: use more revelant names to overlapped callbacksVictor Stinner2014-02-261-10/+10
| | | | For example: "finish_recv", not just "finish".
* asyncio: remove unused imports and unused variables noticed by pyflakesVictor Stinner2014-02-201-1/+0
|
* Fix spelling & typosYury Selivanov2014-02-181-1/+1
|
* Add new event loop exception handling API (closes issue #80).Yury Selivanov2014-02-181-2/+6
| | | | | | | | New APIs: - loop.set_exception_handler() - loop.default_exception_handler() - loop.call_exception_handler()
* Remove more relics of resolution/granularity.Guido van Rossum2014-02-081-1/+0
|
* Copy a bunch of fixes by Victor for the Proactor event loop from the CPython ↵Guido van Rossum2014-01-311-4/+10
| | | | repo.
* Fix _make_subprocess_transport(): pass extra value to the constructorVictor Stinner2014-01-291-1/+1
|
* Code cleanup: remove unused functionAndrew Svetlov2014-01-261-3/+0
|
* Cleanup properly proactor event loopVictor Stinner2014-01-101-4/+13
| | | | | | | | | * store the "self reading" future when the "self pipe" is closed (when the event loop is closed) * store "accept" futures to cancel them when we stop serving * close the "accept socket" if the "accept future" is cancelled Fix many warnings which can be seen when unit tests are run in verbose mode.
* Use WaitForSingleObject() instead of trusting TimerOrWaitFired.Richard Oudkerk2013-11-241-2/+9
|
* Fix policy refactoring last-minute change for Windows.Guido van Rossum2013-11-041-1/+4
|
* Refactor SIGCHLD handler, by Anthony Baire. Fixes issue 67.Guido van Rossum2013-11-041-2/+12
|
* Satisfy (most) pep8 whitespace requirements.Guido van Rossum2013-11-011-0/+16
|
* Tweak import of _overlapped and add instructions README (mostly for myself :-).Guido van Rossum2013-10-291-5/+1
|
* Add support for running subprocesses on Windows with the IOCP event loop.Richard Oudkerk2013-10-271-0/+28
|
* Make the IOCP proactor support "waitable" handles.Richard Oudkerk2013-10-251-0/+40
|
* MergeGuido van Rossum2013-10-171-3/+3
|
* Look for _overlapped module in two places.Guido van Rossum2013-10-151-1/+5
|