Skip to content

http.get randomly throwing HttpException and HandshakeException when fetching from HTTPS  #16768

Open
@DartBot

Description

This issue was originally filed by ben.pl...@gmail.com


What steps will reproduce the problem?

Here is roughly the code I am running. Its purpose is to download data from freebase about a bunch of movies. I am using Future.delayed to space the requests out over time (1/second), though it appears to happen more consistently if I make the interval small, say, 5/second.

void dartBugCode() {
  var movieList = ['Movie Title A', 'Movie Title B', 'Movie C']; //thousands of items long
  for (var i = 0; i < movieList.length; i++) {
    var filmTitle = movieList[i];
    new Future.delayed(new Duration(seconds: i), () {
      var query = {
        'type': '/film/film',
        'name': filmTitle,
        'mid': null
      };
      var queryString = JSON.encode(query);
      queryString = Uri.encodeQueryComponent(queryString);
      var url = 'https://www.googleapis.com/freebase/v1/mqlread?query=$queryString';
      http.get(url).then((response) {
        print(JSON.decode(response.body));
      }, onError: (e, stackTrace) {
        print(e);
        print(stackTrace);
      });
    });
  }
}

What is the expected output? What do you see instead?
I've run the same setup as above on different, non-SSL domains, and everything works as expected. However, over HTTPS, I get random exceptions thrown, either: "HandshakeException: Connection terminated during handshake" OR "HttpException: Connection closed before full header was received".

What version of the product are you using? On what operating system?
Dart VM version: 1.2.0-dev.4.0 (Fri Feb 7 10:19:23 2014) on "macos_x64"

Please provide any additional information below.
This appears to be similar to issue #15419, which was closed as "fixed", so perhaps this is related. Additionally, when these errors occur, they seem to happen in clumps, so 10 requests will happen normally and then all of a sudden 10 requests in a row will all fail rapidly.

Metadata

Assignees

No one assigned

    Labels

    area-webUse area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.library-htmlweb-librariesIssues impacting dart:html, etc., libraries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions