Ben Darnell [Sun, 13 Oct 2013 21:07:18 +0000 (17:07 -0400)]
Fix double logging of exceptions with both @asynchronous and @coroutine.
Tornado 3.1 made the @asynchronous decorator optional when @coroutine
is used, but if it was used anyway both @asynchronous and the new code
would log any uncaught exceptions.
Ben Darnell [Sun, 8 Sep 2013 18:02:21 +0000 (14:02 -0400)]
Fix warnings during final GC of the test suite in python 3.4a1.
3.4 can GC things that were uncollectable before, like abandoned generators.
It also seems generates ResourceWarnings for unclosed files in places
where older versions did not.
Ben Darnell [Sun, 8 Sep 2013 16:15:53 +0000 (12:15 -0400)]
Add a default_handler_class setting for custom 404 pages.
The previous solution for custom 404s (a r'.*' rule at the end of the
handlers list) proved to be undiscoverable for many users, and it
could be nontrivial to put the rule in the right place in the presence
of multiple add_handlers calls and the implicit StaticFileHandler rules.
Ben Darnell [Mon, 19 Aug 2013 03:54:59 +0000 (23:54 -0400)]
In add_callback, hold the lock while writing to the waker pipe.
This protects against a shutdown race condition seen occasionally in
the ThreadedResolver unittests. This slightly increases contention
on the callback lock in multi-threaded scenarios, but the cost is
limited by the fact that we only write to the pipe once per IOLoop
iteration.
Ben Darnell [Tue, 13 Aug 2013 03:34:00 +0000 (23:34 -0400)]
Update ca-certificates.crt to the current Mozilla version.
This file was generated by downloading
https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
in a web browser to avoid the chicken-and-egg problem with mk-ca-bundle's
built-in downloading, and then running "mk-ca-bundle.pl -n".
Note that we were not affected by the recently-fixed curl bug
(https://github.com/bagder/curl/commit/51f0b798fa), but only because
it had been so long since we had updated this file.
Ben Dyer [Fri, 12 Jul 2013 06:35:09 +0000 (16:35 +1000)]
Correctly handle EAGAIN when writing to PipeIOStreams
BaseIOStream._handle_write needs to catch IOError and OSError as
well as socket.error in order to handle EAGAIN when writing to a
PipeIOStream (which doesn't appear to raise socket.error when the
buffer is full).
This also provides consistency with the exceptions caught by
BaseIOStream._read_to_buffer.
Ben Darnell [Sun, 7 Jul 2013 17:30:00 +0000 (13:30 -0400)]
Unify lists of errnos used in IOStream.
We generally want to treat aborted connections the same regardless of the
specific errno, but some calls caught ECONNRESET and ECONNABORTED
while others only caught ECONNRESET. Reported in #828.
Ben Darnell [Wed, 12 Jun 2013 03:32:40 +0000 (23:32 -0400)]
Set CLOEXEC on subprocess pipe endpoints so they are not inherited by the child.
This is what the subprocess module does when it creates pipes, and is
necessary so that a close of the writing side of the stdin pipe will
be recognized by the child process.
Ben Darnell [Thu, 6 Jun 2013 01:43:16 +0000 (21:43 -0400)]
Catch StreamClosedErrors in WebSocketHandler and abort.
When the stream is closed with buffered data, the close callback won't
be run until all buffered data is consumed, but any attempt to write
to the stream will fail, as will reading past the end of the buffer.
This requires a try/except around each read or write, analogous to the
one introduced in HTTPServer in commit 3258726f.
Ben Darnell [Sat, 1 Jun 2013 21:30:33 +0000 (17:30 -0400)]
Reuse a single ThreadPoolExecutor for all ThreadedResolvers.
The primary motivation is that shutting down a ThreadPoolExecutor takes
100ms in the 2.x backported version of concurrent.futures. It's also
generally unnecessary to create lots of DNS resolver threads just
because multiple resolver objects are used.
Ben Darnell [Sat, 1 Jun 2013 00:45:42 +0000 (20:45 -0400)]
Make the auth*_redirect methods all return Futures.
The OAuth 1.0 authorize_redirect is asynchronous, but this is not obvious
since it doesn't take a callback and instead just calls self.finish.
This fails in coroutines because the request will be auto-finished too soon.
Add Future returns to this method, and to all the rest for consistency.
Update docs and add tests for the various styles of login handlers.
Ben Darnell [Sat, 1 Jun 2013 00:03:02 +0000 (20:03 -0400)]
Doc patch for 3.0: replace @gen.coroutine with @gen.engine.
The oauth 1.0 redirect methods are asynchronous even though they don't
take a callback, so we don't want the end of the coroutine to trigger
a call to self.finish.