[Qt-interest] Problems with QSslSocket hanging

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Jul 27 22:30:32 CEST 2010


You are correct..   However, I built a debug version of the openssl and stepped in,that function isn't hanging at all..

I turned on all the debug info I could in QtNetwork, and here is what I got.

Note, there is an error in a call to WSAIoctl to on both http and https connections...  and the comments say to ignore it...

Im going nuts here

Scott


QAbstractSocket::QAbstractSocket(TcpSocket, QAbstractSocketPrivate == 0x486a560, parent == 0x0)
QSslSocket::QSslSocket( QObject(0x0)  ), this = 0x486a518 
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 0 bytes
QAbstractSocket::abort()
QHttp state changed 0 -> 2
QSslSocket::connectToHostImplementation( "tc.echomd.com" , 443 , OpenMode( "ReadOnly|WriteOnly" ) ) 
	creating internal plain socket 
QAbstractSocket::QAbstractSocket(TcpSocket, QAbstractSocketPrivate == 0x486f690, parent == 0x486a518)
QAbstractSocket::connectToHost("tc.echomd.com", 443, 3)...
QSslSocket::_q_stateChangedSlot( QAbstractSocket::HostLookupState ) 
QAbstractSocket::connectToHost("tc.echomd.com", 443) == false (connection in progress)
QAbstractSocketPrivate::_q_startConnecting(hostInfo == {96.10.19.60})
QSslSocket::_q_stateChangedSlot( QAbstractSocket::ConnectingState ) 
QSslSocket::_q_hostFoundSlot() 
	state = QAbstractSocket::ConnectingState 
QAbstractSocketPrivate::_q_connectToNextAddress(), connecting to 96.10.19.60:443, 1 left to try
QAbstractSocketPrivate::resetSocketLayer()
[QSocks5] not proxying 
'qttest.exe': Loaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL'
WSA error : WSAEINVAL
more details (An invalid argument was supplied.)
QAbstractSocketPrivate::initSocketLayer(TcpSocket, IPv4Protocol) success
QNativeSocketEnginePrivate::nativeConnect() to 96.10.19.60 :: 443
WSA error : WSAEWOULDBLOCK
more details (A non-blocking socket operation could not be completed immediately.)
QNativeSocketEnginePrivate::nativeConnect(96.10.19.60, 443) == false (Connection in progress)
QNativeSocketEnginePrivate::nativeConnect() to 96.10.19.60 :: 443
WSA error : WSAEWOULDBLOCK
more details (A non-blocking socket operation could not be completed immediately.)
QNativeSocketEnginePrivate::nativeConnect(96.10.19.60, 443) == false (Connection timed out)
QAbstractSocketPrivate::connectionNotification() testing connection
QAbstractSocketPrivate::_q_testConnection() connection failed, checking for alternative addresses
QAbstractSocketPrivate::_q_connectToNextAddress(), connecting to 96.10.19.60:443, 0 left to try
QAbstractSocketPrivate::resetSocketLayer()
'qttest.exe': Unloaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL'
The thread 'Win32 Thread' (0x500) has exited with code 0 (0x0).
[QSocks5] not proxying 
'qttest.exe': Loaded 'C:\Windows\SysWOW64\WSHTCPIP.DLL'
WSA error : WSAEINVAL
more details (An invalid argument was supplied.)
QAbstractSocketPrivate::initSocketLayer(TcpSocket, IPv4Protocol) success
QNativeSocketEnginePrivate::nativeConnect() to 96.10.19.60 :: 443
WSA error : WSAEWOULDBLOCK
more details (A non-blocking socket operation could not be completed immediately.)
QNativeSocketEnginePrivate::nativeConnect(96.10.19.60, 443) == false (Connection in progress)
QNativeSocketEnginePrivate::nativeConnect() to 96.10.19.60 :: 443
WSA error : WSAEWOULDBLOCK
more details (A non-blocking socket operation could not be completed immediately.)
QNativeSocketEnginePrivate::nativeConnect(96.10.19.60, 443) == false (Connection timed out)
QAbstractSocketPrivate::connectionNotification() testing connection
QAbstractSocketPrivate::_q_testConnection() connection failed, checking for alternative addresses
QAbstractSocketPrivate::_q_connectToNextAddress(), all addresses failed.
QSslSocket::_q_stateChangedSlot( QAbstractSocket::UnconnectedState ) 
QSslSocket::_q_errorSlot( QAbstractSocket::NetworkError ) 
	state = QAbstractSocket::UnconnectedState 
	errorString = "Unknown error" 
QHttp state changed 2 -> 6
QSslSocket::close() 
QAbstractSocket::close()
QAbstractSocketPrivate::canWriteNotification() flushing
QAbstractSocketPrivate::flush() nothing to do: valid ? yes, writeBuffer.isEmpty() ? yes

-----Original Message-----
From: Thomas Dähling [mailto:t.daehling at googlemail.com] 
Sent: Tuesday, July 27, 2010 12:35 PM
To: Scott Aron Bloom
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problems with QSslSocket hanging

Scott,

this is probably not helping a lot, but if I read the bug report
comments correctly then they did not fix the underlying issue but just
create a "maximum delay" workaround that would abort the entropy
generation if it takes longer than that, and even then it still scales
with the number of allocations as this is still called at least once.

/Thomas

2010/7/27 Scott Aron Bloom <Scott.Bloom at onshorecs.com>:
> Thomas,
>
> Turns out its not the problem..  OpenSSL fixed this problem in the 0.9.8m release.
>
> Something else is hanging, and isn't showing in the stack..
>
> Scott
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Scott Aron Bloom
> Sent: Tuesday, July 27, 2010 4:52 AM
> To: Thomas Dähling
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Problems with QSslSocket hanging
>
> Thomas,
>
> THANKS for the lead.. Im not sure it's the problem (too tired right now, but I wanted to say thanks)
>
> Qt definitely uses OpenSsl, Ill re-read the thread and patch my OpenSSL if necessary..
>
> Anyone else have any other prospects?
>
> Scott
> -----Original Message-----
> From: Thomas Dähling [mailto:t.daehling at googlemail.com]
> Sent: Tuesday, July 27, 2010 4:39 AM
> To: Scott Aron Bloom
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Problems with QSslSocket hanging
>
> Isn't Qt using OpenSsl? I remember that OpenSsl uses Heap32Next()
> which used to return in constant time before Win7 but with Win7 it is
> depending upon the amount of objects allocated on the heap. This can
> even trigger the problem that the SSL connection times out. Not sure
> if OpenSSL fixed this yet, though. Tried checking but their website is
> down for me at the moment... one way or another, according to Google
> this is the link to the issue:
> http://rt.openssl.org/Ticket/Display.html?id=2100&user=guest&pass=guest
>
> HTH,
> /Thomas
>
> 2010/7/27 Scott Aron Bloom <Scott.Bloom at onshorecs.com>:
>> I moved my development box from XP to Win7, and Qt is working just fine with
>> no problems.. Except SSL based http connections..
>>
>> Here is what I have done, originally I was using OpenSSL 0.9.8k but have
>> also tried 0.9.8m with no difference.
>>
>> I have completely rebuilt the openssl libraries.
>> I have confirmed the two dlls load with no issues at all. I have botha debug
>> and release version (not necessary previously, but I figured what the
>> heck).  Makes no difference.
>>
>> QSslSocket::supportsSsl() returns true.  The libraries load into Qt.  And
>> the symbols load up.
>>
>> However, in using QHttp or QNetworkAccessmanager with a https url, it sits
>> until the underlying system times out (45 seconds for QHttp, 1 min for QNAM)
>>
>> Any ideas?   And help will be greatly appreciated, Ive been working on this
>> for 30+ hours trying all sorts of crap...
>>
>> Scott
>>
>> The sample code is as simple as it gets...
>>
>>
>> QNetworkRequest request( QUrl( "https://....." ) );
>>
>> QNetworkAccessManager man;
>>
>> QNetworkReply * rep = man.get( request );
>>
>>
>> Ive tried a bunch of https connections, its not a certificate thing..
>> Scott
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>




More information about the Qt-interest-old mailing list