From 6e50b9f54970b1527162fba5611b8d1b41a9d9ba Mon Sep 17 00:00:00 2001 From: davidben Date: Fri, 11 Mar 2016 17:40:34 -0800 Subject: Add histograms to track down the cause of ERR_SSL_PROTOCOL_ERROR. These histograms will be removed when the bug is resolved (or really as soon as we get data back, so hopefully Monday...). Notably, they record BoringSSL error reasons which are *not* stable. The intent of these histograms is to: - Determine what BoringSSL error is triggering these. - Based on magnitudes, confirm this is coming from Read/Write and not Connect. - See if there is a correlation with some cipher suite by comparing the distribution with the normal cipher suite distribution. BUG=593963 Review URL: https://codereview.chromium.org/1786593003 Cr-Commit-Position: refs/heads/master@{#380827} --- net/socket/ssl_client_socket_openssl.cc | 32 ++++++++++++++++++++++++++++++++ net/socket/ssl_client_socket_openssl.h | 2 ++ 2 files changed, 34 insertions(+) (limited to 'net') diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index a98b815..15531d0 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -1083,6 +1083,13 @@ bool SSLClientSocketOpenSSL::DoTransportIO() { return network_moved; } +uint16_t SSLClientSocketOpenSSL::GetCipherSuite() { + const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl_); + if (!cipher) + return 0; + return static_cast(SSL_CIPHER_get_id(cipher)); +} + // TODO(cbentzel): Remove including "base/threading/thread_local.h" and // g_first_run_completed once crbug.com/424386 is fixed. base::LazyInstance::Leaky g_first_run_completed = @@ -1169,6 +1176,14 @@ int SSLClientSocketOpenSSL::DoHandshake() { } else { ssl_failure_state_ = SSL_FAILURE_UNKNOWN; } + + // TODO(davidben): Remove this once https://crbug.com/593963 is resolved. + if (net_error == ERR_SSL_PROTOCOL_ERROR) { + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolErrorCipher.Connect", + GetCipherSuite()); + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolErrorReason.Connect", + ERR_GET_REASON(error_info.error_code)); + } } GotoState(STATE_HANDSHAKE_COMPLETE); @@ -1647,6 +1662,15 @@ int SSLClientSocketOpenSSL::DoPayloadRead() { net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED, rv, user_read_buf_->data()); } else if (rv != ERR_IO_PENDING) { + // TODO(davidben): Remove this once https://crbug.com/593963 is resolved. + if (rv == ERR_SSL_PROTOCOL_ERROR) { + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolErrorCipher.Read", + GetCipherSuite()); + UMA_HISTOGRAM_SPARSE_SLOWLY( + "Net.SSLProtocolErrorReason.Read", + ERR_GET_REASON(pending_read_error_info_.error_code)); + } + net_log_.AddEvent( NetLog::TYPE_SSL_READ_ERROR, CreateNetLogOpenSSLErrorCallback(rv, pending_read_ssl_error_, @@ -1675,6 +1699,14 @@ int SSLClientSocketOpenSSL::DoPayloadWrite() { &error_info); if (net_error != ERR_IO_PENDING) { + // TODO(davidben): Remove this once https://crbug.com/593963 is resolved. + if (net_error == ERR_SSL_PROTOCOL_ERROR) { + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolErrorCipher.Write", + GetCipherSuite()); + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolErrorReason.Write", + ERR_GET_REASON(error_info.error_code)); + } + net_log_.AddEvent( NetLog::TYPE_SSL_WRITE_ERROR, CreateNetLogOpenSSLErrorCallback(net_error, ssl_error, error_info)); diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h index d1078a9..bf286e6 100644 --- a/net/socket/ssl_client_socket_openssl.h +++ b/net/socket/ssl_client_socket_openssl.h @@ -127,6 +127,8 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { void DoReadCallback(int result); void DoWriteCallback(int result); + uint16_t GetCipherSuite(); + bool DoTransportIO(); int DoHandshake(); int DoHandshakeComplete(int result); -- cgit v1.1