win32, latest Lazarus and FPC
Any single web request call works OK, returning the content.
When 2 browsers are open and calling the web module at the same time there is a crash happening after the 2nd one finishes working (just made a loop in the web action which lasts a few seconds to have both requests inside the server at the same time).
Details:
in /fpc/packages/fcl-web/src/fpapache.pp

Function TCustomApacheApplication.ProcessRequest(P: PRequest_Rec) : Integer;

Var
  Req : TApacheRequest;
  Resp : TApacheResponse;

begin
  Req:=TApacheRequest.CreateReq(Self,P);
  Try
    Resp:=TApacheResponse.CreateApache(Req);
    Try
HandleRequest(Req,Resp); <== call happens here OK but 2nd concurrent request does not return, gets lost in the ether
    Finally
      Result:=OK;
      Resp.Free;
    end;
  Finally
    Req.Free;
  end;
end;


procedure TCustomApacheApplication.HandleRequest(ARequest: TRequest; AResponse: TResponse);

Var
  MC : TCustomHTTPModuleClass;
  M  : TCustomHTTPModule;
  MN : String;
  MI : TModuleItem;

begin
  try
    MC:=Nil;
    If (OnGetModule<>Nil) then
      OnGetModule(Self,ARequest,MC);
    If (MC=Nil) then
      begin
      MN:=GetModuleName(ARequest);
      If (MN='') and Not AllowDefaultModule then
        Raise EFPApacheError.Create(SErrNoModuleNameForRequest);
      MI:=ModuleFactory.FindModule(MN);
      If (MI=Nil) and (ModuleFactory.Count=1) then
        MI:=ModuleFactory[0];
      if (MI=Nil) then
        begin
        Raise EFPApacheError.CreateFmt(SErrNoModuleForRequest,[MN]);
        end;
      MC:=MI.ModuleClass;
      end;
    M:=FindModule(MC); // Check if a module exists already
    If (M=Nil) then
      begin
        M:=MC.Create(Self);
        M.Name := '';//without this there's a crash due to same name
      end;
M.HandleRequest(ARequest,AResponse);//calls the web action here, works OK for both concurrent requests
  except
    On E : Exception do
      ShowRequestException(AResponse,E);
  end;
end; <== everything works, but the 2nd concurrent request crashes after here but before returning to the caller function


A little bit strange that this happens. The return content is prepared in both simultaneous calls properly. Any thoughts what could be the cause?

AB


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to