[fpc-devel] Lazarus Apache module crashes during concurrent requests

ABorka fpc-devel at aborka.com
Wed Oct 1 04:03:26 CEST 2008


Nevermind, on Ubuntu the request_rec is only 384 bytes for FPC instead 
of 412.

But that still does not explain why the handler function is not even 
getting called by apache.


ABorka wrote:
> OK, after 4 days of pulling my (remaining) hair out I was able to 
> compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8).
> 
> It seems both fpc/lazarus (not working apache module) and the C compiled 
> (working apache module) one shows
> 
> sizeof(request_rec) =  412
> sizeof(module_struct) = 56
> 
> So the length seems to be the same for for both. Still, the Lazarus 
> compiled apache module doesn't even load in apache (mod_hello.pp or any 
> of the other examples included in fpc).
> If the exports is included then it loads but doesn't work at all:
> 
> modified "mod_hello.pp" from fpc/packages/httpd22/examples/
> {*******************************************************************
> *  Test library of the Apache Pascal Headers
> *******************************************************************}
> library mod_hello;
> 
> {*******************************************************************
> *  The mode must be objfpc on this unit because the unix code uses
> * some extensions introduced on Free Pascal
> *******************************************************************}
> {$ifdef fpc}
>   {$mode objfpc}{$H+}
> {$endif}
> 
> {$IFDEF WIN32}
>   {$DEFINE WINDOWS}
> {$ENDIF}
> 
> {$define Apache2_2}
> 
> uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif};
> 
> var
>  test_module: module; public name 'test_module';
>  default_module_ptr: Pmodule;
> 
> const
>   MODULE_NAME = 'mod_hello.so';
> 
> {*******************************************************************
> *  Free Pascal only supports exporting variables on Windows
> *******************************************************************}
> { $ifdef WINDOWS}//commented out, exports work in Linux now
> exports
>  test_module name 'test_module';
> { $endif}//commented out, exports work in Linux now
> .
> .snip
> .
> 
> 
> Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 
> or 2.2.9 on Ubuntu.
> The above module is loaded, the handler registering function is called, 
> but the handler never gets triggered when the module is called from a 
> browser.
> 
> 
> Michael Van Canneyt wrote:
>>>
>>> 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 at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>>
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list