rlebeau on master
February-29th-workaround (#338)… (compare)
I have anothe question. We have in TIdIOHandlerStack.Connected
ReadFromSource(False, 0, False);
What indy is supposed to read here? Sometimes (vary rarely) my application based on RemObjects SuperTCPServer hangs there as there is nothing to read from server.
select()function (which has been known to happen, despite the timeout - that is an OS issue, not an Indy issue).
your comment makes sense in case if it hangs while calling Readable (ATimeout) in TIdIOHandler.ReadFromSource. But in reality it hangs inside call
LByteCount := ReadDataFromSource(LBuffer); a few lines below. I can imagine next multithread scenario:
1) first thread actively does IO over socket
2) second thread checks for connection and for this moment due activity of first thread Readable returns true.
3) Second thread calls ReadDataFromSource, but for this moment first thread fully has processed data => second thread hangs there.
Remobject's SuperTCPServer depends on Indy library and assumes that Indy10 supports multithread processing.
As for me fix should be in calling of just Readable inside TIdIOHandlerStack.Connected instead of ReadFromSource
@josdebr_twitter what is the EXACT error message? What does the call stack look like when the error occurs?
the exact error message is: "ERangeError raised: Range check error". I get the error after I call "IMAPClient.Retrieve(i, Msg)"
I've managed to generate a callstack, I can even get you a Eureka log file if you can read it. But here is the callstack extracted from my log:
IdGlobalProtocols.pas| |GetUniqueFileName |1644 |
IdGlobalProtocols.pas| |GetUniqueFileName |1599 |
IdGlobalProtocols.pas| |MakeTempFilename |1584 |
IdGlobalProtocols.pas| |MakeTempFilename |1549 |
IdAttachmentFile.pas |TIdAttachmentFile |PrepareTempStream |144 |
IdMessageClient.pas | |ProcessAttachment |840 |
IdMessageClient.pas | |ProcessAttachment |833 |
IdMessageClient.pas |TIdMessageClient |ReceiveBody |1024|
IdMessageClient.pas |TIdMessageClient |ProcessMessage |1535 |
IdMessageClient.pas |TIdMessageClient |ProcessMessage |1527 |
IdMessageHelper.pas | |Internal_TIdMessageClientHelper_ProcessMessage|60 |
IdMessageHelper.pas | |Internal_TIdMessageClientHelper_ProcessMessage|48 |
IdMessageHelper.pas | |Internal_TIdMessageHelper_LoadFromStream |85 |
IdMessageHelper.pas | |Internal_TIdMessageHelper_LoadFromStream |76 |
IdMessageHelper.pas | |TIdMessageHelper_LoadFromStream |97 |
IdMessageHelper.pas | |TIdMessageHelper_LoadFromStream |96 |
IdIMAP4.pas |TIdIMAP4 |InternalRetrieve |4951 |
IdIMAP4.pas |TIdIMAP4 |InternalRetrieve |4892 |
IdIMAP4.pas |TIdIMAP4 |Retrieve |4601 |
IdIMAP4.pas |TIdIMAP4 |Retrieve |4599 |