FPiette 384 Posted October 3, 2023 4 hours ago, PizzaProgram said: Just wanted to give a final report Thanks for your feedback! Share this post Link to post
PizzaProgram 9 Posted May 12 [Final Solution] <= v9.1 There must be 4 things manually programmed, to prevent memory violation when running ICS (SSL CLI) in background threads: Set MySslHttpCli.MultiThreaded := True; Create one global component in the main-thread at program start, and initializing OpenSSL3 DLLs from there. OverbyteIcsLIBEAY.IcsLoadSsl(); Destroy that global component only at program end. (This way OpenSSL can stay in memory, and initialized only once.) Create and initialize ICS components only inside the EXECUTE method of background threads ! (Otherwise the web-calls will still run in the main thread. Reason: ICS is uning Window handles.) Recommendation: - Create a fail safe code inside procedures where get / post etc is being called: if GetCurrentThreadId <> SslHttpCli3.ThreadID then raise Exception.Create('! ERROR ! SslHttpCli component of ICS is called from a different Thread! Not the one it was created: ' + IntToStr(SslHttpCli3.ThreadID)); ... until next release of ICS (>= 9.2? ) does it automatically. Share this post Link to post