In r39542 we changed the dart:io HttpClient shutdown handling. This
enables proper handling of HTTP persistent connections. However this also
adds the requirement for calling HttpClient.close when done using it. Failing
to call HttpClient.close can cause your dart:io programs to hang until the
HttpClient.idleTimeout has expired after all I/O activity has otherwise
completed. The default value for HttpClient.idleTimeout is 15 seconds.
Note that the documentation for dart:io HttpClient have always stated that
calling HttpClient.close was required to close idle persistent connections.
If you are experiencing shutdown issues with your dart:io program which might
be related to this change, you can simulate the behavior from before this
change by lowering client.idleTimeout:
var client = new HttpClient();
client.idleTimeout = const Duration(milliseconds: 100);
This should only be used as a short term workaround. Tracking your HttpClient
instances and closing them properly is the right thing to do.
This change will be part of the first 1.7 developer release.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
You can potentially implement this yourself. The new await/async syntax will make it significantly easier to implement. The only requirement is that you get a Future which completes once you're done with an HttpClient. For example:Something like this:// Usage:var client = new HttpClient();using(client, () {return await someOperation(client);});
--