IdHTTP access violation on shutdown

Indy 10:

two threads, thread 1 calls Get on TIdHTTP and blocks read data. thread 2 will cause an open on the same TIdHTTP to abort Get.

I use digest authentication on TIdHTTP and I receive audio video.

callstack for thread 1:

40491D [system.pas][System][@ClassDestroy][8989]
69EF2B [..\..\common\IdAuthenticationDigest.pas][IdAuthenticationDigest][TIdDigestAuthentication.Destroy][109]
404567 [system.pas][System][TObject.Free][8313]
6A2B69 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoOnDisconnected][1587]
534574 [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][532]
534B3B [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][767]
6A3FB3 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoRequest][2101]

callstack for thread 2:

402BA3 [system.pas][System][@FreeMem][2477]
404521 [system.pas][System][TObject.FreeInstance][8294]
40491D [system.pas][System][@ClassDestroy][8989]
69EF2B [..\..\common\IdAuthenticationDigest.pas][IdAuthenticationDigest]        [TIdDigestAuthentication.Destroy][109]
404567 [system.pas][System][TObject.Free][8313]
6A2B69 [..\..\Common\IdHTTP.pas][IdHTTP][TIdCustomHTTP.DoOnDisconnected][1587]
534574 [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][532]
534B3B [IdTCPConnection.pas][IdTCPConnection][TIdTCPConnection.Disconnect][767]

basically at the end of the DoRequest it gets disconnected. there seems to be a race condition on disconnects trying to release Request.Authentication.

downloaded the latest code for Indy 10 and looked at the code, I believe that the behavior should be the same.

I believe that calling disconnect from another thread is the recommended usage pattern, am I mistaken? Is this a bug in Indy? it seems like you need to block the disconnect, but it's hard to understand which locks can create. Has anyone else encountered this?

+5
1

, , , , Request.Authentication , . , , Disconnect() DoOnDisconnect(), IOHandler , IOHandler DoOnDisconnect() .

, OnStatus, , hsDisconnecting, hsDisconnected. IOHandler.Close() DoOnDisconnect() , , Request.Authentication .

+6

All Articles