Commit Graph

574 Commits

Author SHA1 Message Date
Yury Selivanov 3b263e65a8
bpo-32684: Fix gather to propagate cancel of itself with return_exceptions (GH-7224) 2018-05-29 19:20:01 -04:00
Yury Selivanov e151f83dea
bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7180)
[3.6 backport of 989b9e0]
2018-05-29 00:55:27 -04:00
Victor Stinner 7593b8a507 bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (GH-7188)
Fix a race condition in SSLProtocol.connection_made() of
asyncio.sslproto: start immediately the handshake instead of using
call_soon(). Previously, data_received() could be called before the
handshake started, causing the handshake to hang or fail.

(cherry picked from commit be00a5583a)
2018-05-29 00:46:48 -04:00
Miss Islington (bot) a6d6bd70ac
bpo-33469: RuntimeError after closing loop that used run_in_executor (GH-7171)
(cherry picked from commit fdccfe09f0)

Co-authored-by: Yury Selivanov <yury@magic.io>
2018-05-28 18:32:17 -07:00
Miss Islington (bot) 7e8819a589 bpo-31647: Fix write_eof() after close() for SelectorSocketTransport (GH-7149) (#7154)
Fixed bug where calling write_eof() on a _SelectorSocketTransport after
it's already closed raises AttributeError.
(cherry picked from commit 23f587e395)

Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
2018-05-28 16:25:03 -04:00
CtrlZvi 749afe81ec [3.6] bpo-26819: Prevent proactor double read on resume (GH-6921) (#7110)
The proactor event loop has a race condition when reading with
pausing/resuming. `resume_reading()` unconditionally schedules the read
function to read from the current future. If `resume_reading()` was
called before the previously scheduled done callback fires, this results
in two attempts to get the data from the most recent read and an
assertion failure. This commit tracks whether or not `resume_reading`
needs to reschedule the callback to restart the loop, preventing a
second attempt to read the data..
(cherry picked from commit 4151061855)

Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
2018-05-25 11:03:25 +03:00
Andrew Svetlov 7208bfb64b
[3.6] bpo-33263: Fix FD leak in _SelectorSocketTransport (GH-6450) (#7025)
* bpo-33263 Fix FD leak in _SelectorSocketTransport. (GH-6450)

Under particular circumstances _SelectorSocketTransport can try to add a reader
even the transport is already being closed. This can lead to FD leak and
invalid stated of the following connections. Fixed the SelectorSocketTransport
to add the reader only if the trasport is still active..
(cherry picked from commit a84d0b361a)
2018-05-21 13:09:49 +03:00
Serhiy Storchaka 49418f6df7
[3.6] bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (#7006)
* repr() was called for a borrowed link.
* str() was used instead of repr() in formatting one error message.
(cherry picked from commit 6655354afc)
2018-05-20 17:33:55 +03:00
Andrew Svetlov 017e9fda92
[3.6] bpo-33037: Skip sending/receiving after SSL transport closing (GH-6044) (GH-6058)
* Skip write()/data_received() if sslpipe is destroyed.
(cherry picked from commit 5e80a71ab6)
2018-03-10 19:09:07 +02:00
Miss Islington (bot) a23eecab9a bpo-32841: Fix cancellation in awaiting asyncio.Condition (GH-5665) (GH-5683)
(cherry picked from commit 5746510b7a)

Co-authored-by: Bar Harel <bzvi7919@gmail.com>
2018-02-14 12:10:18 +02:00
Bar Harel 7e4cf8e95d [3.6] bpo-32734: Fix asyncio.Lock multiple acquire safety issue (GH-5466) (#5502)
(cherry picked from commit d41e9e0952)
2018-02-02 18:15:31 -05:00
Miss Islington (bot) 32518b439b bpo-26133: Fix typos (GH-5010) (#5014)
* Fix typos
* Change warning text
* Add test
(cherry picked from commit a8f4e15f3d)
2017-12-26 12:29:29 +02:00
Miss Islington (bot) 5ff5d1167d bpo-26133: Clear signals list on interpreter finalizing (GH-5002) (#5003)
(cherry picked from commit 4f146f9ed1)
2017-12-24 14:30:57 +02:00
Miss Islington (bot) 3bc68cff5b bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (GH-4956) (#4962)
(cherry picked from commit 4a02543cf9)
2017-12-21 19:42:32 +02:00
Yury Selivanov 572636d425
bpo-27456: Ensure TCP_NODELAY is set on linux (#4231) (#4898)
(cherry picked from commit e796b2fe26)
2017-12-15 21:53:08 -05:00
Miss Islington (bot) f54e405200 asyncio: Remove unused Future._tb_logger attribute (GH-4596) (#4598)
It was only used on Python 3.3, now only Future._log_traceback is
used.
(cherry picked from commit c16bacec3c)
2017-11-28 10:32:28 +01:00
Miss Islington (bot) f35076a002 bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable GH-4409 (#4411)
(cherry picked from commit 43605e6bfa)
2017-11-15 19:28:25 -05:00
Andrew Svetlov cc0961c517
[3.6] bpo-32015: Asyncio looping during simultaneously socket read/write an… (GH-4386) (#4393)
* bpo-32015: Asyncio cycling during simultaneously socket read/write and reconnection

* Tests fix

* Tests fix

* News add

* Add new unit tests.
(cherry picked from commit e1d62e0b7c)
2017-11-14 12:14:51 +02:00
Miss Islington (bot) ac4f6d4448 bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (GH-3813) (#4326)
(cherry picked from commit c62f0cb3b1)
2017-11-07 22:08:15 +03:00
Antoine Pitrou d8d218ffda
[3.6] bpo-31970: Reduce performance overhead of asyncio debug mode. (GH-4314) (#4322)
* bpo-31970: Reduce performance overhead of asyncio debug mode..
(cherry picked from commit 921e9432a1)
2017-11-07 17:50:48 +01:00
Miss Islington (bot) 518c6b9786 bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (GH-4319) (#4320)
(cherry picked from commit 22b1128559)
2017-11-07 17:22:18 +01:00
Miss Islington (bot) 9c23b173b8 bpo-31632: fix set_protocol() in _SSLProtocolTransport (GH-3817) (GH-3817) (#4052)
(cherry picked from commit ea2ef5d0ca)
2017-10-19 14:12:44 -04:00
Victor Stinner 5013a5ebc9 [3.6] bpo-31250: test_asyncio: fix dangling threads (#3517)
* bpo-31250, test_asyncio: fix dangling threads (#3252)

* Explicitly call shutdown(wait=True) on executors to wait until all
  threads complete to prevent side effects between tests.
* Fix test_loop_self_reading_exception(): don't mock loop.close().
  Previously, the original close() method was called rather than the
  mock, because how set_event_loop() registered loop.close().

(cherry picked from commit 16432beadb)

* bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (#3264)

Call doCleanups() to close the loop after calling
executor.shutdown(wait=True): see TestCase.set_event_loop() of
asyncio.test_utils.

Replace also gc.collect() with support.gc_collect().

(cherry picked from commit e8a533fbc7)
2017-09-12 14:18:23 -07:00
Miss Islington (bot) ff125e1aa9 bpo-31350: Optimize get_event_loop and _get_running_loop (GH-3347) (GH-3373)
* call remove_done_callback in finally section

* Optimize get_event_loop and _get_running_loop

* rename _loop_pid as loop_pid and add blurb news

* rename _loop_pid as loop_pid and add blurb news

* add back _RunningLoop

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst

* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst
(cherry picked from commit 80bbe6a7b6)
2017-09-05 20:05:35 -07:00
Victor Stinner 23caf8cfc6 bpo-30280: Cleanup threads in ayncio tests (#2501) (#2511)
* bpo-30280: asyncio now cleans up threads

asyncio base TestCase now uses threading_setup() and
threading_cleanup() of test.support to cleanup threads.

* asyncio: Fix TestBaseSelectorEventLoop cleanup

bpo-30280: TestBaseSelectorEventLoop of
test.test_asyncio.test_selector_events now correctly closes the event
loop: cleanup its executor to not leak threads.

Don't override the close() method of the event loop, only override
the_close_self_pipe() method.

(cherry picked from commit b903067462)
2017-06-30 17:20:33 +02:00
Mariatta 20f1029584 [3.6] Fix a typo in a comment in coroutines.py (GH-2267) (GH-2370)
defiend -> defined
(cherry picked from commit cab469245d)
2017-06-23 22:44:57 -07:00
Yury Selivanov 83d30bd667 Revert "[3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2062)" (#2112)
This reverts commit 6e14fd2a14.
2017-06-11 16:46:45 +02:00
Yury Selivanov 176f2ebdad bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2109) 2017-06-11 14:00:14 +00:00
Yury Selivanov 6e14fd2a14 [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2062)
* bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (#409)

(cherry picked from commit a608d2d5a7)

* [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409)

* asyncio SSL contexts leak sockets after calling close with certain servers

* cleanup _shutdown_timeout_handle on _fatal_error.
(cherry picked from commit a608d2d5a7)
2017-06-10 10:00:45 -04:00
Yury Selivanov 361362f3a0 [3.6] Fix TypeError is asyncio/proactor_events (GH-993) (#2061)
(cherry picked from commit 34792d25ab)
2017-06-10 00:15:28 -04:00
Yury Selivanov fe9c7a0fd3 Break circular references when closing SSLTransport objects (#981) (#2049) 2017-06-09 19:14:35 -04:00
Yury Selivanov 7a16a4535d Closing transport during handshake process leaks socket (#480) (#2044) 2017-06-09 18:33:31 -04:00
Yury Selivanov fa7f519113 Fix waiter cancellation in asyncio.Lock (#1031) (#2037)
Avoid a deadlock when the waiter who is about to take the lock is
cancelled

Issue #27585
2017-06-09 17:07:48 -04:00
Łukasz Langa 70705e3cdf [3.6] call remove_done_callback in finally section (GH-1688) (#1755)
(cherry picked from commit 21b3e04c13)
2017-05-23 00:36:23 -07:00
INADA Naoki 3dc7c52a9f bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)
when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.

example:

    async def coro():
        asyncio.Task.current_task().cancel()
        return 42
    ...
    res = await coro()  # should raise CancelledError

(cherry picked from commit 991adca012)
2017-05-11 21:56:42 +09:00
Mariatta a3d8dda7d8 bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170) (#1247)
(cherry picked from commit ae5b3260dd)
2017-04-21 19:58:28 -07:00
Yury Selivanov 99f8d33a94 bpo-29742: asyncio get_extra_info() throws exception (#525) (#645) 2017-03-12 17:06:16 -04:00
Yury Selivanov 2ef08d3be7 asyncio: Optimize _get_running_loop() to call getpid() only when there's a loop 2017-03-02 23:58:29 -05:00
Seth M. Larson 604faba1db bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405) 2017-03-02 23:31:17 -05:00
Yury Selivanov 01e5230ef0 bpo-29703: asyncio: Fix creating new event loops in child processes. (#404) (#410) 2017-03-02 22:06:15 -05:00
Mariatta Wijaya 6138432e59 Issue #29314: Merge with 3.5 2017-02-06 22:05:10 -08:00
Mariatta Wijaya 4e7ff8b1a3 Issue #29314: Set the stacklevel to two in asyncio.async() Deprecation Warning 2017-02-06 22:03:00 -08:00
Yury Selivanov 11c135136d Merge 3.5 (issue #28990) 2016-12-16 11:51:57 -05:00
Yury Selivanov b1461aa781 Issue #28990: Fix SSL hanging if connection is closed before handshake completed. 2016-12-16 11:50:41 -05:00
Yury Selivanov 5cb0c09fa6 Merge 3.5 (issue #28652) 2016-11-21 17:47:41 -05:00
Yury Selivanov dab0584738 Issue #28652: Partially rollback previous changes
Allow AF_UNIX in create_server & create_connection
2016-11-21 17:47:27 -05:00
Yury Selivanov 21bb0e6f55 Merge 3.5 (issue #28704) 2016-11-15 15:27:23 -05:00
Yury Selivanov d7c151871e Issue #28704: Fix create_unix_server to support Path-like objects 2016-11-15 15:26:34 -05:00
Yury Selivanov 27182bb232 Merge 3.5 (issue #28703) 2016-11-15 15:21:07 -05:00
Yury Selivanov 0ed20cdfb7 Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. 2016-11-15 15:20:34 -05:00