sp0987 0 Posted October 17, 2023 We have project which was migrated from Delphi 7 to Delphi 11. In delphi7, we used "ICS - Internet Component Suite - V8 - Delphi 7 to RAD Studio 10.4 Sydney Revised: Dec 17, 2020 Release: V8.65". We didn't face any problem like server stop automatically after certain amount of time. In Delphi 11, we used "ICS - Internet Component Suite - V8 - Delphi 7 to RAD Studio 10.4 Sydney Revised: August 22, 2023 Release: V9.0". In this we are facing the server stop problem. Share this post Link to post
Angus Robertson 574 Posted October 17, 2023 Can you please answer the several questions I have previously asked, rather than just repeating one of the symptoms of your problem? Angus Share this post Link to post
sp0987 0 Posted October 26, 2023 Am not repeating , am just making things clear so that you can understand the issue. May I know the questions which I haven't answered you. Share this post Link to post
Angus Robertson 574 Posted October 26, 2023 I'd like to know for what purpose you are using the ICS web server, what application, and why you are trying to disable server timeouts with WebServerSSL.KeepAliveTimeSec := 0; WebServerSSL.KeepAliveTimeXferSec := 0; Web servers are not supposed to keep idle connections opens unless keep-alive is requested. The Heartbeat timer should ignore zero timeouts, but I've never tested it, since no-one needs that feature. Also, you sometimes mention the connection being closed, sometimes the web server, which seems highly unlikely. Angus Share this post Link to post
sp0987 0 Posted October 27, 2023 Ours is a webserver project developed using Delphi7. It's a service based project and we need internet components in order to meet our demand to connect to the web. We have utilized "Tsslhttpserver and TICSLogger" components in our project. According to the previous discussion, the server did not disconnect after the idle period; the clients that were connected when the server was opened did. Using our Delphi 7 project, we behave in the same way. We encountered AV when we moved our project from Delphi 7 to Delphi 11. As a result of AV, we observed that the server and client would also become disconnected. Thus, to address the problem, we considered employing The values of WebServerSSL.KeepAliveTimeSec and WebServerSSL.KeepAliveTimeXferSec are equal to zero. However, it didn't resolve our problem. One by one, the clients disconnect in the "TCustomWSocketServer.WMClientClosed" process. Eventually, the client ID sets to "0," freeing the client. AV in Delphi11 appears when the last client disconnects, the client ID is set to Zero'0', and we attempt to call client.free. Share this post Link to post
Angus Robertson 574 Posted October 27, 2023 Thanks for the information, but you have not explained what the clients are doing. And I'm still confused as to why you think clients being disconnected when idle is a bad thing, that is the design. If you want idle clients to remain connected, set long KeepAlive timeouts, several hours. Zero for no disconnect is not documented as a design feature., The ICS web server is well tested over 20 years, in use on many public web servers, including my own. Angus Share this post Link to post
sp0987 0 Posted October 27, 2023 Long-term client connectivity was not my intention. The clients become disconnected in accordance with the design, and that is definitely not my problem. My issue is that "we are receiving AV when the last client disconnects, which causes a server disconnect." Share this post Link to post
Angus Robertson 574 Posted October 27, 2023 If you get an exception in that function, your application has probably already freed the client, although the exception should have happened a few lines higher. But it could also be memory corruption. If you have recently converted your application from Delphi 7 AnsiStrings to Unicode, I would look very carefully at all your string handling for received data. Angus Share this post Link to post
sp0987 0 Posted October 30, 2023 Prior to that line, the client was not free, and I changed the strings to make them compatible. It didn't stop the AV, though. Any other suggestions? Share this post Link to post
Angus Robertson 574 Posted October 30, 2023 Sorry, no simple answer, something your own code is doing is corrupting memory, so the client can not be freed correctly. Or a function being called from the client. No easy way to find the problem. Perhaps comment out various parts of the code until the problem disappears to narrow it down. Angus Share this post Link to post
sp0987 0 Posted October 30, 2023 Am attaching the call stack. Hope so it serves to narrow down the issue Call Stack.docx Share this post Link to post
Angus Robertson 574 Posted October 30, 2023 Sorry, I don't have the time to debug end user applications, only fix proven reproducible problems in the ICS components. Angus Share this post Link to post
FPiette 383 Posted October 30, 2023 2 hours ago, sp0987 said: Any other suggestions? Put a breakpoint in the client destructor and also on the line where the AV occurs (client.free). And run the application. If the destructor brekpoint is hit before the one on client.free, then try to understand why the client is destroyed before the call to free. Share this post Link to post
sp0987 0 Posted October 30, 2023 The destructor didn't hit before the client disconnect. When the server was opened , 4 clients were connected to the server . And when the server was idle for the keepalivetime sec's, then the clients will be disconnected using the highlighted LOC(FWSocketServer.Disconnect(Cli);). But for the last client the line will be skipped as the if condition fails and then it calls the "procedure TCustomWSocketServer.WMClientClosed(var msg: TMessage);" method using "procedure TCustomWSocketServer.WndProc(var MsgRec: TMessage);" Here when calling client.free, the AV appears. In this total execution, the client destructor wasn't called before the client disconnect. Share this post Link to post
Angus Robertson 574 Posted October 30, 2023 I would recommend you upgrade to the latest ICS V9.0, there were a number of fixes relating to objects not being freed after exceptions, lots of clean-up, particularly for Win64 servers. There is no general problem with the ICS web server crashing, the following is from the status page of one of my public ICS web servers, doing SQL queries, REST requests and standard web pages, it just keeps running, until time for Windows Update or a new version: WSocket: TWSocket (c) 1996-2023 Francois Piette V9.1 Server: THttpServer (c) 1999-2023 F. Piette V9.0 Windows Boot Time: 10-Oct-2023 21:54:24 WebAppTelecom Start Time: 10-Oct-2023 22:54:27 Server OS: Windows Server 2019 Standard 1809 Win64 10.0.17763 Compiler: Delphi 11.3 Win64 OpenSSL Version: Static OpenSSL 3.0.11 19 Sep 2023, Legacy Provider Loaded OK SQL Requests: 49,572 Total Requests: 104,933 Total Connections: 117,470 Max Simultaneous Connections: 60 Total Data Received: 73.7M Total Data Transmitted: 3.03G Angus Share this post Link to post
sp0987 0 Posted November 16, 2023 The problem was fixed. Objects that are created without initializing to Nil are the source of the issue. It provided AV in the most recent Delphi version, but it functioned in earlier versions. Thank you for your kind support. Share this post Link to post