Jump to content
PizzaProgram

Can ICS thread cause memory violation? (EOutOfResources error)

Recommended Posts

4 hours ago, PizzaProgram said:

Just wanted to give a final report

Thanks for your feedback!

Share this post


Link to post

[Final Solution]  <= v9.1

 

There must be 4 things manually programmed, to prevent memory violation when running ICS (SSL CLI) in background threads:

  1. Set MySslHttpCli.MultiThreaded := True; 
     
  2. Create one global component in the main-thread at program start, and initializing OpenSSL3 DLLs from there. 
    OverbyteIcsLIBEAY.IcsLoadSsl();
     
  3. Destroy that global component only at program end. (This way OpenSSL can stay in memory, and initialized only once.)
     
  4. 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×