[fpc-devel] Lazarus Apache module crashes during concurrent requests
Leonardo M. Ramé
martinrame at yahoo.com
Fri Jul 10 22:30:35 CEST 2009
Does this was fixed? I'm trying to deploy an apache 2.2.9 module, it compiles and loads ok (it doesn't crash apache) but its exported function isn't called, I'm using the same code ABorka used in this example.
This is my configuration:
Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Linux debian 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686 GNU/Linux
Leonardo.
----- Original Message ----
From: ABorka <fpc-devel at aborka.com>
To: FPC developers' list <fpc-devel at lists.freepascal.org>
Sent: Tuesday, September 30, 2008 11:03:26 PM
Subject: Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests
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
>
_______________________________________________
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