Commit Graph

841 Commits

Author SHA1 Message Date
Yury Selivanov 0e72f817eb
Bump the version to 0.14.0 2019-11-05 09:42:18 -05:00
Yury Selivanov 9b4bd2ea4a
Bump the version to 0.14.0rc2 2019-10-28 23:55:12 -04:00
Fantix King 6fd6264145
run `test_shutdown_timeout_handler_not_set` in aio 2019-10-28 23:55:12 -04:00
Fantix King e6fd63774e
fix missing data on EOF in flushing
* when EOF is received and data is still pending in incoming buffer,
  the data will be lost before this fix
* also removed sleep from a recent-written test
2019-10-28 23:55:11 -04:00
Yury Selivanov d76d982717
Fix KeyboardInterrupt handling logic.
When uvloop is run in the main thread we *always* want to set up a
self-pipe and a signal wakeup FD.  That's the only way how libuv
can be notified that a ^C happened and break away from selecting
on sockets.

asyncio does not need to do that, as the 'selectors' module it uses
is already aware of the way Python implements ^C handling.

This translates to a slightly different behavior between asyncio &
uvloop:

1. uvloop needs to always call signal.set_wakeup_fd() when run in the
  main thread;

2. asyncio only needs to call signal.set_wakeup_fd() when a user
  registers a signal handler.

(2) means that if the user had not set up any signals, the signal
wakeup FD stays the same between different asyncio runs.  This commit
fixes uvloop signal implementation to make sure that uvloop behaves
the same way as asyncio in regards to signal wakeup FD between the
loop runs.  It also ensures that uvloop always have a proper
self-pipe set up so that ^C is always supported when it is run in
the main thread.

Issue #295.
2019-10-28 22:57:29 -04:00
Yury Selivanov 679fde69f2
Bump to 0.14.0rc1 2019-10-25 17:04:48 -04:00
Yury Selivanov 695a520195
Fix wheels upload 2019-10-25 17:03:54 -04:00
Elvis Pranskevichus ef7040d1a2
Fix manylinux for 3.8
3.8 has dropped the 'm' ABI suffix.
2019-10-25 12:03:30 -04:00
Fantix King 7fcbfed1ef fix None _shutdown_timeout_handle issue
* Fixes #255
* Also make handles more robust
2019-10-25 10:22:31 -04:00
Yury Selivanov b2aa8dbbaa
Fix a compiler warning in process.pyx 2019-10-25 00:10:59 -04:00
Yury Selivanov 006805091c
Drop explicit `loop=` argument from test_wakeup_fd_unchanged 2019-10-25 00:10:59 -04:00
Yury Selivanov 3e6a0430f6
Use higher-level wrappers for the __forkHandler global 2019-10-25 00:10:59 -04:00
Yury Selivanov bed926c500
Avoid double connecting to remote_addr for datagram transports
Issue #276.
2019-10-24 23:01:28 -04:00
Yury Selivanov dd4cb7ac26
Handle unix sockets in UDP
Fixes #269.

Co-authored-by: Dmitry Orlov <me@mosquito.su>
2019-10-24 22:41:12 -04:00
Yury Selivanov 0814a4f6a8
Stop passing the `loop` arg around in in test_spawning_external_process 2019-10-24 22:30:43 -04:00
Adam Bella fde5d14f7d fix - uvloop freeze when something other than uvloop invoke process fork and execute non-python process
Problem:
Uvloop for each loop register `atFork` handler that is called after fork is executed by forked child.
This handler works fine when fork was invoked by uvloop. In case fork is invoked by something else (such as external library)
uvloop freeze in this handler because:
- GIL is acquired inside `atFork` handler -> in case forked child does not contain python runtime `atFork` handler freeze at obtaining GIL
- when compiled in debug mode (`make debug`) cython trace calls are inserted inside compiled `atFork` handler -> in case forked child does not contain python runtime `atFork` handler freeze at providing trace call

Solution:
This fix solve described problems by implementing `atFork` handler as C function so that forked child can call it safely whether or not contains python runtime.
2019-10-24 22:24:16 -04:00
Yury Selivanov 1a0d6578aa
Fix #259: handle large timeouts in loop.call_later() 2019-10-24 22:21:42 -04:00
Yury Selivanov ee02de2bd1
Note that it's recommended to upgrade pip before installing uvloop 2019-10-24 22:18:27 -04:00
Yury Selivanov b849936c7b
issue template: Ask if uvloop behaves differently from vanilla asyncio 2019-10-24 18:12:13 -04:00
Yury Selivanov 34fd827eb1
Bump libuv to v1.33.1 2019-10-24 17:28:39 -04:00
Vladimir Matveev 48d376d30c Keep behavior of run_* consistent with event loops bundled in CPython: ensure that wakeup fd is non-modified if it was not changed before i.e. via calling add_signal_handler 2019-10-24 14:58:29 -04:00
Yury Selivanov 176569118e travis: Add 3.8 to the mix; drop "sudo" 2019-10-24 14:42:54 -04:00
Yury Selivanov 5f48dab8fa tests: Support 3.8 2019-10-24 14:42:54 -04:00
Yury Selivanov 51636f7b72 asyncio.CancelledError is BaseException now, so fix `except Exception` 2019-10-24 14:42:54 -04:00
Yury Selivanov 0bb811d11f tests: Stop using @asyncio.coroutine in tests 2019-10-24 14:42:54 -04:00
Yury Selivanov eb8d7ba170 tests: Stop passing loop explicitly in tests
In 3.8 a lot of asyncio functions have their `loop` parameter
deprecated.  So we change the semantics of uvloop tests to never
pass the loop explicitly (unless to Future objects, when necessary)

That means that we now also need to set up asyncio/uvloop loop policies
for tests in setUp hooks.
2019-10-24 14:42:54 -04:00
Yury Selivanov 65c1a045b5 Bump Cython & pyOpenSSL deps to most recent 2019-10-24 14:42:54 -04:00
Fantix King 5905f27a95 prefer PROTOCOL_TLS than PROTOCOL_SSLv23 2019-10-22 16:47:12 -04:00
Yury Selivanov d9ad177152
Ignore mypy cache 2019-10-22 16:46:30 -04:00
Fantix King 6b91061cff fix test_renegotiation 2019-10-21 13:21:01 -04:00
Fantix King 82104fb68e
add app state check (#263)
* add app state check

* fixes #246

* add test to cover the case

* CRF: rename states and fix comment
2019-08-24 08:02:29 +08:00
Yury Selivanov 1eb6727437 Update libuv to v1.31.0 2019-08-13 18:32:40 -07:00
Toby Harradine ef29dab2c8 Don't log OSError in transports
Resolves #257.
2019-07-17 19:53:50 -07:00
Miro Hrončok 72c8e2aebd sys.set_coroutine_wrapper is removed in Python 3.8
The functions `sys.set_coroutine_wrapper` and `sys.get_coroutine_wrapper`,
which were provisionally added to Python 3.5 and deprecated in Python 3.7,
are removed in Python 3.8.

uvloop doesn't use them since Python 3.7, but they remained defined
in stdlib.pxi, leading to AttributeErrors on Python 3.8+.

This makes the definition fallback to None if such functions don't exist.

Fixes https://github.com/MagicStack/uvloop/issues/251
2019-06-13 12:12:32 -04:00
Yury Selivanov 291afecace Bump Cython to 0.29.10 2019-06-11 16:53:53 -04:00
Yury Selivanov a566599332 Fix compilation warnings under Cython 0.29.10 2019-06-11 16:52:25 -04:00
Fantix King cbbac15f65 enforce TLS<1.3 for SSL renegotiation tests
* fixes #248
2019-05-07 11:18:39 -04:00
Yury Selivanov 6e24e88eb8 A better uvloop.install() example 2019-04-25 12:44:57 -04:00
Yury Selivanov c181ecd333 Promote uvloop.install() to be the default approach 2019-04-25 12:43:24 -04:00
Yury Selivanov 5e5e9988b3 Bump many-linux to 2010 2019-04-23 16:53:18 -04:00
Yury Selivanov a9ecf9e606 Bump the version to 0.14.0.dev0 2019-04-22 12:41:15 -04:00
Yury Selivanov 46c5e9ebe4 Refactor udp.sendto() and pyaddr->sockaddr conversion
* sendto() now tries to use uv_udp_try_send() first

* __convert_pyaddr_to_sockaddr() was optimized to maintain an
  internal LRU cache of resolved addresses (quite an expensive
  operation)
2019-04-16 18:09:29 -04:00
Yury Selivanov c2b65bc8d2 Start using high-performance uv_udp_t handle again
* Upgrade to libuv v1.28.0.  This is the new minimal supported
  libuv version.

* Switch from using uv_poll_t to uv_udp_t.  This leads to
  significant performance improvements.
2019-04-16 18:09:29 -04:00
Yury Selivanov e3b00b8102 Make test_call_later_rounding more stable (but less strict) 2019-03-20 13:24:47 -04:00
Yury Selivanov 2b6620b811 Fix memory leak related to call_later() and call_at()
The crux of the problem is that TimerHandle did not clean up a strong
reference from the event loop to `self`.  This typically isn't a problem
unless there's another strong reference to the loop from the callback or
from its arguments (such as a Future).

A few new unit tests should ensure this kind of bugs won't happen again.

Fixes: #239.
2019-03-20 10:26:53 -04:00
Fantix King 73529c5b45 Round delay in call_later()
* Fixes #233.
2019-03-18 11:38:17 -04:00
Jelle Zijlstra 73396ae961 fix compilation warnings on older Python versions 2019-03-17 13:14:18 -04:00
Jeremy Lainé d6c67e7a72 Make Server an asynchronous context manager (fixes: #221)
The Server class was missing __aenter__ and __aexit__ magic methods to
allow usage of the form:

  async with server:
    await server.serve_forever()
2019-03-17 13:13:33 -04:00
Jeremy Lainé c7802b40e8 Upgrade to libuv v1.27.0. 2019-03-17 13:12:37 -04:00
Fantix King 6c70216c0f Fix SSL memory leak
Refs bpo-34745, protocol and transport form circular reference,
causing SSLContext stack up ugly.
2019-03-17 13:07:09 -04:00