Commit Graph

581 Commits

Author SHA1 Message Date
Victor Stinner b97de3dd86
bpo-33353: test_asyncio set SO_SNDBUF after connect (GH-7086)
bpo-32622, bpo-33353: On macOS, sock.connect() changes the
SO_SNDBUF value. Only set SO_SNDBUF and SO_RCVBUF buffer sizes
once a socket is connected or binded, not before.
2018-05-24 02:43:45 +02:00
Victor Stinner 2932755cc1
bpo-33353: test_asyncio uses smaller sendfile data (#7083)
bpo-32622, bpo-33353: sendfile() tests of test_asyncio use socket
buffers of 1 kB "to test on relative small data sets". Send only
160 KiB rather 10 MB to make the test much faster.

Shrink also SendfileBase.DATA from 1600 KiB to 160 KiB.

On Linux, 3 test_sock_sendfile_mix_with_regular_send() runs now take
less than 1 second, instead of 18 seconds.

On FreeBSD, the 3 tests didn't hang, but took 3 minutes. Now
the 3 tests pass in less than 1 seconds.
2018-05-24 00:56:00 +02:00
Christian Heimes 529525fb5a
bpo-33618: Enable TLS 1.3 in tests (GH-7079)
TLS 1.3 behaves slightly different than TLS 1.2. Session tickets and TLS
client cert auth are now handled after the initialy handshake. Tests now
either send/recv data to trigger session and client certs. Or tests
ignore ConnectionResetError / BrokenPipeError on the server side to
handle clients that force-close the socket fd.

To test TLS 1.3, OpenSSL 1.1.1-pre7-dev (git master + OpenSSL PR
https://github.com/openssl/openssl/pull/6340) is required.

Signed-off-by: Christian Heimes <christian@python.org>
2018-05-23 22:24:45 +02:00
Andrew Svetlov b7555babe9
Use IPv4 only to avoid IP address collision (#7030) 2018-05-21 15:06:26 +03:00
Andrew Svetlov e253752191
Fix asyncio flaky tests (#7023) 2018-05-21 12:03:45 +03:00
Vlad Starostin a84d0b361a bpo-33263: Fix FD leak in _SelectorSocketTransport (GH-6450)
* 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.
2018-05-21 11:13:45 +03:00
Christian Heimes d361e99868
bpo-32262: Fix typo in f-string (GH-7016)
Fix typo from commit 6370f345e1

Signed-off-by: Christian Heimes <christian@python.org>

<!--
Thanks for your contribution!
Please read this comment in its entirety. It's quite important.

# Pull Request title

It should be in the following format:

```
bpo-NNNN: Summary of the changes made
```

Where: bpo-NNNN refers to the issue number in the https://bugs.python.org.

Most PRs will require an issue number. Trivial changes, like fixing a typo, do not need an issue.

# Backport Pull Request title

If this is a backport PR (PR made against branches other than `master`),
please ensure that the PR title is in the following format:

```
[X.Y] <title from the original PR> (GH-NNNN)
```

Where: [X.Y] is the branch name, e.g. [3.6].

GH-NNNN refers to the PR number from `master`.

-->


<!-- issue-number: bpo-32262 -->
https://bugs.python.org/issue32262
<!-- /issue-number -->
2018-05-20 19:57:13 +02:00
CtrlZvi 4151061855 bpo-26819: Prevent proactor double read on resume (#6921)
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.
2018-05-20 13:21:10 +03:00
Steve Dower e5f41d2f1e
bpo-33522: Enable CI builds on Visual Studio Team Services (#6865) 2018-05-16 17:50:29 -04:00
Antoine Pitrou 9d3627e311
bpo-33332: Add signal.valid_signals() (GH-6581) 2018-05-04 13:00:50 +02:00
Ned Deily 8534d53333
bpo-32517: fix test_read_pty_output() hangs on macOS 10.13.2+ (GH-6037) (GH-6113)
test_asyncio hangs indefinitely on macOS 10.13.2+ on `read_pty_output()`
using the KqueueSelector. Closing `proto.transport` (as is done in
`write_pty_output()`) seems to fix it.
(cherry picked from commit 12f74d8608)

Co-authored-by: Nathan Henrie <n8henrie@users.noreply.github.com>

Also, re-enable test_read_pty_output on macOS.
2018-03-27 17:16:49 -04:00
Andrew Svetlov 5e80a71ab6
bpo-33037: Skip sending/receiving after SSL transport closing (GH-6044)
* Skip write()/data_received() if sslpipe is destroyed
2018-03-10 17:48:35 +02:00
Christian Heimes 05d9fe32a1
bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes (#5663)
* bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes

Misc fixes and workarounds for compatibility with OpenSSL 1.1.1-pre1 and
TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by
default. Some test cases only apply to TLS 1.2. Other tests currently
fail because the threaded or async test servers stop after failure.

I'm going to address these issues when OpenSSL 1.1.1 reaches beta.

OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS
1.3. The feature is enabled by default for maximum compatibility with
broken middle boxes. Users should be able to disable the hack and CPython's test suite needs
it to verify default options.

Signed-off-by: Christian Heimes <christian@python.org>
2018-02-27 08:55:39 +01:00
Andrew Svetlov a19fb3c6aa
bpo-32622: Native sendfile on windows (#5565)
* Support sendfile on Windows Proactor event loop naively.
2018-02-25 19:32:14 +03:00
Bar Harel 5746510b7a bpo-32841: Fix cancellation in awaiting asyncio.Condition (#5665) 2018-02-14 11:18:11 +02:00
Oren Milman d019bc8319 bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995) 2018-02-13 19:28:33 +09:00
Bar Harel 2f79c01493 bpo-32734: Fix asyncio.Lock multiple acquire safety issue (GH-5466) 2018-02-02 17:04:00 -05:00
Andrew Svetlov 3d4dbd8f01
Implement TimerHandle.when() (#5473) 2018-02-01 19:59:32 +02:00
Yury Selivanov 1e5b25b8c0
bpo-23749: Make start-tls tests more stable on win7 buildbot (GH-5409)
To mitigate the situation when the buildbot is under load
and is unable to send/receive data fast enough:

* reduce the size of the payload
* set a generous timeout for socket ops
2018-01-29 00:25:05 -05:00
Yury Selivanov 631fd38dbf
bpo-32251: Implement asyncio.BufferedProtocol. (#4755) 2018-01-28 16:30:26 -05:00
Yury Selivanov bec2372b7e
bpo-32327: Revert loop.run_in_executor behaviour: return a Future. (#5392)
I've run some tests on 3.7 asyncio and it appears that too many
things assume that run_in_executor returns a Future.
2018-01-28 14:09:40 -05:00
Andrew Svetlov 0f54e00e96
Fix tests if Python compiled without SSL (#5367) 2018-01-28 00:00:37 +02:00
Yury Selivanov b1a6ac4c40
bpo-32622: Enforce sendfile fallback policy for FALLBACK transports (#5364) 2018-01-27 15:52:52 -05:00
Andrew Svetlov 7c684073f9
bpo-32622: Implement loop.sendfile() (#5271) 2018-01-27 21:22:47 +02:00
Yury Selivanov f13f12d8da
bpo-32630: Use contextvars in decimal (GH-5278) 2018-01-27 13:46:46 -05:00
Christian Heimes 61d478c71c
bpo-31399: Let OpenSSL verify hostname and IP address (#3462)
bpo-31399: Let OpenSSL verify hostname and IP

The ssl module now uses OpenSSL's X509_VERIFY_PARAM_set1_host() and
X509_VERIFY_PARAM_set1_ip() API to verify hostname and IP addresses.

* Remove match_hostname calls
* Check for libssl with set1_host, libssl must provide X509_VERIFY_PARAM_set1_host()
* Add documentation for OpenSSL 1.0.2 requirement
* Don't support OpenSSL special mode with a leading dot, e.g. ".example.org" matches "www.example.org". It's not standard conform.
* Add hostname_checks_common_name

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 15:51:38 +01:00
Yury Selivanov 4112c5b97d
bpo-32662: Try making test_asyncio.test_server more reliable (#5338) 2018-01-26 01:30:57 -05:00
José Melero Fernández c47dacb690 bpo-32574: Fix leaks in asyncio.Queue.put() and .get() (#5208) 2018-01-25 18:45:43 -05:00
Yury Selivanov c9070d03f5
bpo-32662: Implement Server.start_serving() and Server.serve_forever() (#5312)
* bpo-32662: Implement Server.start_serving() and Server.serve_forever()

New methods:

* Server.start_serving(),
* Server.serve_forever(), and
* Server.is_serving().

Add 'start_serving' keyword parameter to loop.create_server() and
loop.create_unix_server().
2018-01-25 18:08:09 -05:00
Andrew Svetlov fe133aad52
bpo-32391: Implement StreamWriter.wait_closed() (#5281) 2018-01-25 00:30:30 +02:00
Victor Stinner 789e359f51 bpo-32636: Fix two bugs in test_asyncio (#5302) 2018-01-24 15:15:14 -05:00
Nathaniel J. Smith fb5a7ad421 bpo-32636: Fix @asyncio.coroutine debug mode bug exposed by gh-5250 (#5291) 2018-01-24 15:14:33 -05:00
Andrew Svetlov 0a5e71b4c7
bpo-32410: Improve sock_sendfile tests (#5294)
* Rename sock_sendfile test methods
* Make sock_sendfile tests more stable
2018-01-24 21:40:35 +02:00
Yury Selivanov 22feeb88b4
bpo-32643: Drop support for a few private Task and Future APIs. (#5293)
Specifically, it's not possible to subclass Task/Future classes
and override the following methods:

* Future._schedule_callbacks
* Task._step
* Task._wakeup
2018-01-24 11:31:01 -05:00
Nathaniel J. Smith 6934831e43 bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280) 2018-01-23 11:09:31 +02:00
Yury Selivanov f23746a934
bpo-32436: Implement PEP 567 (#5027) 2018-01-22 19:11:18 -05:00
Victor Stinner 13ff24582c
bpo-32593: Drop FreeBSD 9 and older support (#5232)
Drop support of FreeBSD 9 and older.
2018-01-22 18:32:50 +01:00
Yury Selivanov a4afcdfa55
bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262) 2018-01-21 14:56:59 -05:00
Nathaniel J. Smith fc2f407829 bpo-32591: Add native coroutine origin tracking (#5250)
* Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth
* Use coroutine origin information in the unawaited coroutine warning
* Stop using set_coroutine_wrapper in asyncio debug mode
* In BaseEventLoop.set_debug, enable debugging in the correct thread
2018-01-21 09:44:07 -05:00
Christian Heimes bd5c7d238c
bpo-32602: Test ECDSA certs (#5247)
Add test certs and test for ECDSA cert and EC/RSA dual mode.

I'm also adding certs for IDNA 2003/2008 tests and simplify some test
data handling.

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-20 15:16:30 +01:00
Andrew Svetlov 7464e87a65
bpo-32410: Make SendfileNotAvailableError exception public (#5243) 2018-01-19 20:04:29 +02:00
Andrew Svetlov 6b5a27975a
bpo-32410: Implement loop.sock_sendfile() (#4976) 2018-01-16 19:59:34 +02:00
Yury Selivanov 21102f0dc2
Make asyncio tests run when there's no SSL module (#5196) 2018-01-15 17:56:32 -05:00
Yury Selivanov 0c36bed1c4
bpo-32458: Temporarily mask start-tls proactor test on Windows (#5054) 2017-12-30 15:40:20 -05:00
Andrew Svetlov ffcb4c0165
bpo-32418: Postfix, raise NotImplementdError and close resources in tests (#5052) 2017-12-30 18:52:56 +02:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 1634fc289a bpo-32418: Add get_loop() method on Server, AbstractServer classes (#4997)
* Add abstract get_loop() method to Server, AbstractServer classes.
* Add test cases for get_loop() method in Server, AbstractServer classes
* Add documentation for get_loop() method
2017-12-30 17:09:32 +02:00
Yury Selivanov f111b3dcb4
bpo-23749: Implement loop.start_tls() (#5039) 2017-12-30 00:35:36 -05:00
Andrew Svetlov a8f4e15f3d
bpo-26133: Fix typos (#5010)
* Fix typos
* Change warning text
* Add test
2017-12-26 11:53:38 +02:00
Yury Selivanov e0aef4f3cd
bpo-31721: Allow Future._log_traceback to only be set to False (#5009) 2017-12-25 16:16:10 -05:00
Yury Selivanov 0cf16f9ea0
bpo-32363: Disable Task.set_exception() and Task.set_result() (#4923) 2017-12-25 10:48:15 -05:00