NetTalk Central

Author Topic: Slow to Close  (Read 3596 times)

Mark Sarson

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Slow to Close
« on: August 23, 2024, 12:21:22 AM »
Good Morning All.

I have a NT webserver (Multi DLL) that is very slow at closing down either when started as a service or on the desktop.

It is taking ~ 20 seconds to close, as can be seen in the debug output.

19   04:10:26.099   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : p_lpSSL_CTX start
20   04:10:26.099   89528   IBSServer.exe   [NetDLL] [1] SSL_Our_Close() : Before CTX Free 27202432 CTX#=0
21   04:10:26.099   89528   IBSServer.exe   [NetDLL] [1] SSL_Our_Close() :  After SSL_CTX+Free
22   04:10:26.099   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : p_lpSSL_CTX end
23   04:10:26.224   89528   IBSServer.exe   [NetDLL] [2] CallBackWindowSrc() : NTThread Event : 523 start
24   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : p_lpSSL_CTX start
25   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SSL_Our_Close() : Before CTX Free 27373032 CTX#=0
26   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SSL_Our_Close() :  After SSL_CTX+Free
27   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : p_lpSSL_CTX end
28   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : Error 10038 Ignored.
29   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SimpleCloseSocket() : p_lpSSL_CTX start
30   04:10:46.748   89528   IBSServer.exe   [NetDLL] [1] SSL_Our_Close() : Before CTX Free 125743376 CTX#=0

Is this expected behaviour or am I able to debug more to work through the issue.

Thanks

Mark

Vinnie

  • Full Member
  • ***
  • Posts: 181
    • View Profile
    • Email
Re: Slow to Close
« Reply #1 on: August 23, 2024, 02:51:59 AM »
Depends if you are using Graceful Close.
If so the server writes the session data to a JSON file.

When you relaunch the server it reads the JSON file so will take time depending on how much data is in the JSON file.

More servers and more sessions the longer the delay.

I always leave the existing server open and start a new server after deleting the JSON file.
This server will error because the current running server has the listening ports open.
After I close the current running server the new server will connect to the listening ports.

Of course I do loose all the existing session but that is perfect for me.



Mark Sarson

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Re: Slow to Close
« Reply #2 on: August 23, 2024, 03:42:55 AM »
Hi Vinnie,

Thank you for the reply :)

In the Debug output I posted, this was just by pressing the close button after a minute of running the server.

For information here, on my development VM, the server closes instantly. Not the same on the deployed server.

Mark

Vinnie

  • Full Member
  • ***
  • Posts: 181
    • View Profile
    • Email
Re: Slow to Close
« Reply #3 on: August 23, 2024, 05:11:52 AM »
OK nothing to do with what I said.

Maybe a thread is still running.

Maybe check Performance Tab and check threads before you press the close.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11242
    • View Profile
Re: Slow to Close
« Reply #4 on: August 26, 2024, 07:13:00 PM »
Vinnie is on the right track here, but there are few details wrong;

If "Save state between runs" is set then all the session data is saved to a state file on close.
This can take time depending o how much there is.
(the file is XML not json).
This is unrelated to graceful close.

Even if the server has only run for a short time there can be a lot of state information, if the state was loaded on startup. So check the size of your state file.

Graceful close completes all active threads before terminating the program. As distinct from a hard close which simply terminates all threads wherever they happen to be.

Bruce

Vinnie

  • Full Member
  • ***
  • Posts: 181
    • View Profile
    • Email
Re: Slow to Close
« Reply #5 on: August 26, 2024, 10:50:34 PM »
Interesting.

Thanks Bruce.

NetTalk 14 my file is host.state.json

Maybe I have set something.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11242
    • View Profile
Re: Slow to Close
« Reply #6 on: August 28, 2024, 03:38:30 AM »
You're right Vinnie!
The state is now stored as JSON - that changed from XML at some point.
Settings are still XML, but that's a different file.

cheers
Bruce