FastCGI server got stuck lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2020-05-12 01:27 Sometimes this happens, especially when I repeatedly send requests. Recently I've got error message (on browser) saying failure in opening a template file. Here's key points of my web-module. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    interface  TwmDC1 = class(TFPWebModule)    MessageForm : TAQTemplate; // Just a descendant of TFPTemplate having a few more fields   // other fields and methods, of course   .....end;  implementation constructor TAQTemplate.Create(fn: string);begin   inherited Create;    TargetAction := nil;   FileName := fn;      // Here, a text file is assigned.    StartDelimiter := '<#';   EndDelimiter := '>';end; procedure TwmDC1.DataModuleCreate(Sender: TObject);begin   MessageForm := TAQTemplate.Create (MessageFormFile);   MessageForm.OnGetParam := SurveyGetParam;end; procedure TwmDC1.DataModuleDestroy(Sender: TObject);begin   MessageForm.Free;end;  Is there any possibility that the file of MessageForm may stay open, or are there any way that I make sure that the file is closed just after it is loaded? Or, will it improve performance if I store the content of the template file within the memory, e.g. as content of a template of an action? I'm not sure whether this is the cause of the "stuck". But suspect that writing files on HDD (saving log data at a file, etc.)  may be one of the possible reasons.  Or slow response from database may be also possible cause. "Got stuck" goes away after a few minutes without any operation on the server. I refresh the web browser, and get what I want. Server is not proper server --- it is a PC with Windows 10 / IIS, serving on DDNS.  I'm testing at harsh conditions.  This machine also runs Firebird server. ---------------------------------------------------------------------- devEric69 · 2020-05-12 07:46 Hello, Concerning logging an environment with multiple threads or multi-forks or multi-instances, I would use one file per PID if I haven't already done so ( especially since it's very simple to set up, with the unit LCLProc ): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IF defined(DEBUG)}LCLProc.DebuglnThreadLog(['time=', DateTimeToStr(Now),': ', '<<@SurveyGetParam: IN ']);{$EndIf} ...\...{$IF defined(DEBUG)}LCLProc.DebuglnThreadLog(['time=', DateTimeToStr(Now),': ', '>>@SurveyGetParam: OUT ']);{$EndIf} QuoteSometimes this happens, especially when I repeatedly send requests. Recently I've got error message (on browser) saying failure in opening a template file. [snip] Is there any possibility that the file of MessageForm may stay open, or are there any way that I make sure that the file is closed just after it is loaded? I don't know too (no expertise in FastCGI). Regards