Frano 0 Posted December 7, 2020 (edited) Hi all. I have a problem and would like to get some points or ideas where to go to solve it: There is a Windows service on server which has TIdHttpServer which listens for incoming messages, handles them, stores data in DB and send response with result or error message. Works for several years now, several messages per day, few MB at max. TIdHttpServer handles messages in OnIdHTTPServerCommandGet handler. Whole process is logged in event viewer. Last week communication stopped. Every message is accepted, handled and stored in db, but when response object is filled, it is not delivered. Event viewer reports all the steps of handling correctly. There is 5 min wait and then exception is raised in OnIdHTTPServerCommandGet function which is also presented in Event viewer. On TIdHttpServer side error is raised as exception after 5 min: Socket Error # 10054 Connection reset by peer. On Sender side error is: 2020-12-01 08:20:21 [pool-1-thread-5] DEBUG com.b2b.jms2ws - header-generator => 2020-12-01 08:20:21 [pool-1-thread-5] DEBUG com.b2b.jms2ws.dochandle - Posting to: http://IPADDRESS:PORT 2020-12-01 08:25:54 [pool-1-thread-5] ERROR com.b2b.framework-base - org.apache.http.NoHttpResponseException: The target server failed to respond I made a local test and service is not responding in timely manner on server where service runs! So problem is between service and Windows enviroment. Firewall is checked and it doesn't block. I made a desktop app with same TIdHttpServer units working and started it instead of service. Communication is working in both ways, no connection timeouts even when message is comming from outside network. Have you experineced similar problem? Do you have any advice where/what to look? Code is: procedure TFrmDesktopTest.IdHTTPServer2CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); var PorukaObjekt: TSpremanjePrimljenePoruke; begin if ARequestInfo.PostStream <> nil then begin PorukaObjekt := TSpremanjePrimljenePoruke.Create(ConnString, InvisibleHandle); try try if not PorukaObjekt.IskopirajStream(ARequestInfo.PostStream) then raise Exception.Create('Stream handling error '); // logging function to enter data in Event viewer LogPoruka('PorukaObjekt.Execute'); if not PorukaObjekt.Execute then raise Exception.Create('Store in DB error. ' + PorukaObjekt.AInfo); AResponseInfo.ContentText := '<SOAP:Envelope xmlns:SOAP=''http://schemas.xmlsoap.org/soap/envelope/''>' + '<SOAP:Header/><SOAP:Body><Response status=''0''><Description>SUCCESS</Description></Response></SOAP:Body></SOAP:Envelope>'; except On E:Exception do begin AResponseInfo.ContentText := '<SOAP:Envelope xmlns:SOAP=''http://schemas.xmlsoap.org/soap/envelope/''>' + '<SOAP:Header/><SOAP:Body><Response status=''1''><Description>E.Message + '</Description></Response></SOAP:Body></SOAP:Envelope>'; LogPoruka(AResponseInfo.ContentText); end; end; finally FreeAndNil(PorukaObjekt); end; end; end; Thanks in advance Frano Edited December 7, 2020 by Frano Share this post Link to post
Remy Lebeau 1396 Posted December 7, 2020 You are just going to have to debug your TIdHTTPServer service and find where the blockage is actually occurring. You say you can reproduce the issue locally, so it should be fairly easy to debug locally. Share this post Link to post
Frano 0 Posted December 8, 2020 (edited) Hi Remy Thanks for reply. Unfortunately on my development and test enviroment service is working ok. Service is not responding on client server where I can access only via OpenVPN and RemoteDesktop. What I did is made a desktop app for sending messages and copied it to server directly and run it there to bypass all possible network causes. I am making service version with more logging and more settings (change port, bypass handling,bypass event logging etc.). If this won't work I'll try to set up remote debugging but not sure if service is accessible in such way. Edited December 8, 2020 by Frano Share this post Link to post
Frano 0 Posted December 8, 2020 (edited) Solved. PorukaObjekt.Execute blocked execution which caused TIdHttpServer to create a timeout exception. Funny that it finished all of its tasks and loggings and then tried something to send which is blocking execution. Previuosly it would just flew over it and there is no check or log for operation. Added storing AResponseInfo.ContentText in logs and saw that it never happened, TIdHttpServer works great. Edited December 8, 2020 by Frano Share this post Link to post