Hi Michael,

Unfortunately, I do not have any C compilers - nor the knowledge to compile something with the apache header files in C. I manually compared the .h/.inc and the translated pascal structures/records for the two you have mentioned (module_struct and request_rec) and they seem to have the same fields, nothing added to them so far till Apache 2.2.9 .
For me in Windows XP 32bit/ FPC:
sizeof(request_rec)=416
sizeof(module_struct)=56

Not sure if it is a full list but in the apr header files (ap_mmn.h) there's a change list:
.
.snip I believe the translation happened for 2.2.3 so those are included
.
+* 20051115.4 (2.2.4)  Added ap_get_server_banner() and
 *                         ap_get_server_description() (minor)
 * 20051115.5 (2.2.5)  Added ap_mpm_safe_kill() (minor)
 * 20051115.6 (2.2.7)  Added retry_set to proxy_worker (minor)
+* 20051115.7 (2.2.7)  Added conn_rec::clogging_input_filters (minor)
 * 20051115.8 (2.2.7)  Added flags to proxy_alias (minor)
+* 20051115.9 (2.2.7)  Add ap_send_interim_response API
 * 20051115.10(2.2.7)  Added ap_mod_status_reqtail (minor)
 * 20051115.11(2.2.7)  Add *ftp_directory_charset to proxy_dir_conf
* 20051115.12(2.2.8) Add optional function ap_logio_add_bytes_in() to mog_logio
 * 20051115.13(2.2.9)  Add disablereuse and disablereuse_set
 *                     to proxy_worker struct (minor)
 * 20051115.14(2.2.9)  Add ap_proxy_ssl_connection_cleanup and
 *                     add *scpool, *r and need_flush to proxy_conn_rec
 *                     structure
 * 20051115.15(2.2.9)  Add interpolate_env to proxy_dir_conf and
 *                     introduce proxy_req_conf.

The ones marked with '+' I added to my httpd.inc and httpd_protocol.inc files. The rest were for apache mods (mod_proxy, etc.) so ignored them. The crash did not go away. At least on Windows, Apache loads the module and executes it sometimes. On Linux the apache modules compiled don't even load.

AB


Michael Van Canneyt wrote:

On Mon, 22 Sep 2008, ABorka wrote:

After some more debugging the result is even stranger:

If I reduce the code to the bare minimum there is still a crash most of the
time.

1. works always for 2 concurrent requests:
procedure TCustomApacheApplication.HandleRequest(ARequest: TRequest;
AResponse: TResponse);
Var
  MC : TCustomHTTPModuleClass;
  M  : TCustomHTTPModule;
  MN : String;
  MI : TModuleItem;
i:Integer;

begin
      MI:=ModuleFactory[0];
      MC:=MI.ModuleClass;
      M:=MC.Create(Self);
      M.Name := '';
aresponse.content := '<html>Hello</html>';
      for i := 0 to Maxint do;//time wasting loop, about 5 secs
end;

2. crashes randomly:
begin
      MI:=ModuleFactory[0];
      MC:=MI.ModuleClass;
      M:=MC.Create(Self);
      M.Name := '';
M.HandleRequest(ARequest,AResponse);
      for i := 0 to Maxint do;//time wasting loop, about 5 secs
end;//<= sometimes crash after here but before returning to caller function

3. always crashes:
begin
  try
      MI:=ModuleFactory[0];
      MC:=MI.ModuleClass;
      M:=MC.Create(Self);
      M.Name := '';
aresponse.content := '<html>Hello</html>';
      for i := 0 to Maxint do;//time wasting loop, about 5 secs
  except
    On E : Exception do
      ShowRequestException(AResponse,E);
  end;
end;//<= guaranteed crash after here but before returning to caller function


When M.HandleRequest(ARequest,AResponse); is used instead of aresponse.content
:= '<html>Hello</html>'; the crash is random at procedure return for the 2nd
simultaneous caller.

When the procedure contains any try/except it is guaranteed not returning
(crashing) after the work is finished for the 2nd caller (2nd simultaneaous
request).

The first simultaneous caller always works without a problem.

Any suggestions?

Yes: please print the size of the Request_rec (or TRequest_Rec) and the
same record in C. Compare if they are equal. Same for the module record.
If they are not equal, then we know it is a problem with the pascal definition of this record. I've had to do this exercise about 30 times myself on various platforms to get it right. Maybe they changed the size again.

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


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

Reply via email to