Issue 16768 in dart: http.get randomly throwing HttpException and HandshakeException when fetching from HTTPS

1,004 views
Skip to first unread message

da...@googlecode.com

unread,
Feb 12, 2014, 1:17:03 PM2/12/14
to bu...@dartlang.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Unassigned

New issue 16768 by ben.plow...@gmail.com: http.get randomly throwing
HttpException and HandshakeException when fetching from HTTPS
http://code.google.com/p/dart/issues/detail?id=16768

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.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

da...@googlecode.com

unread,
Feb 12, 2014, 7:38:36 PM2/12/14
to bu...@dartlang.org
Updates:
Status: Triaged
Labels: Library-Html

Comment #1 on issue 16768 by kev...@google.com: http.get randomly throwing
HttpException and HandshakeException when fetching from HTTPS
http://code.google.com/p/dart/issues/detail?id=16768

(No comment was entered for this change.)

da...@googlecode.com

unread,
Feb 13, 2014, 6:52:25 AM2/13/14
to bu...@dartlang.org
Updates:
Labels: Area-HTML

Comment #2 on issue 16768 by l...@google.com: http.get randomly throwing

da...@googlecode.com

unread,
Feb 13, 2014, 6:56:25 AM2/13/14
to bu...@dartlang.org

Comment #3 on issue 16768 by sgj...@google.com: http.get randomly throwing
HttpException and HandshakeException when fetching from HTTPS
http://code.google.com/p/dart/issues/detail?id=16768

This looks as if the remote host is terminating the connection. Could it be
that the remote host is denying that many requests from one client? Have
you tried to use wget/curl or some other meang to make the same requests?

I was not able to reproduce the issue locally. The returned response is:

{result: null}

for all the requests If I change the movie title to something which is
found I get a "real" result.

By adding the following line

SecureSocket.initialize(useBuiltinRoots: false);

I could provoke a HandshakeException (HandshakeException: Handshake error
in client (OS Error: Peer's Certificate issuer is not recognized., errno =
-8179))

da...@googlecode.com

unread,
May 9, 2014, 7:51:42 PM5/9/14
to bu...@dartlang.org
Updates:
Status: Invalid
Owner: efor...@google.com

Comment #5 on issue 16768 by efor...@google.com: http.get randomly
throwing HttpException and HandshakeException when fetching from HTTPS
http://code.google.com/p/dart/issues/detail?id=16768

+1 for what Søren said. Closing as not a Dart problem.
Please reopen/comment if you use wget/curl/some other language's
httpRequest functionality at the same rate and do NOT get the same failure.
Reply all
Reply to author
Forward
0 new messages