[fpc-devel] Bug report 12110 needs a cleanup in the bug tracker system?

ABorka fpc-devel at aborka.com
Sun Sep 14 20:47:20 CEST 2008


Hi Michael,

"I assume you are not using Lazarus to create your descendents;
if you were, they would be streamed correctly."

Well, it is not my code, I was just trying to understand why fcl-web is 
not working for the apache modules.
In Lazarus when one creates an apache module (package fpweb, File -> New 
-> Apache Module) the compiled module crashes at the first call on the 
web server because of something. Do you think it might be this?

Lazarus Apache modules (which are sitting in memory on the web server 
after server startup) need to create a webmodule for a request at 
runtime (or multiple ones at a time for concurrent requests /which is 
not in the code at the moment in fcl-web fpapache.pp/). This problem 
seems to be a blocker at the moment to make these apache modules work.
Unfortunately, my OO knowledge is not sufficient for this :) thats why I 
was asking, suspected that it is something on the object design level.

After my last few fixes and improvements I added some more fixes which I 
did not submit yet (the CGI applications should work properly after 
applying it), I was trying to get this fixed first so we could get 
working apache modules too.

AB

Michael Van Canneyt wrote:
> 
> On Sat, 13 Sep 2008, ABorka wrote:
> 
>> Hi Michael,
>>
>> I see 12110 is applied now, super :)
>>
>> I am trying to improve on the fcl-web and the next step would be to fix the
>> apache module related things. However, there is a problem I could use some
>> help with.
>> It seems that when the apache module (TCustomApacheApplication) tries to
>> create an instance of the TFPWebModule when a web request comes in, it just
>> crashes:
>> To my best knowledge this happens in (fpapache.pp)
>> TCustomApacheApplication.HandleRequest at line
>>
>> M:=MC.Create(Self);
>>
>> MC and M are declared
>>   MC : TCustomHTTPModuleClass;
>>   M  : TCustomHTTPModule;
>>
>> I believe I've tracked the problem to (rtl/objpas/classes/dm.inc)
>>
>> Constructor TDataModule.Create(AOwner: TComponent);
>> begin
>>   CreateNew(AOwner);
>>   if (ClassType <> TDataModule) and
>>     not (csDesigning in ComponentState) then
>>     begin
>>     if not InitInheritedComponent(Self, TDataModule) then
>>       raise EStreamError.CreateFmt(SErrNoSTreaming, [ClassName]);
>>     if OldCreateOrder then
>>       DoCreate;
>>     end;
>> end;
>>
>> The raise always seems to be happening when anything other than a TDataModule
>> class is created (including TDataModule descendants).
>> I've tried with all the TDataModule descendants in fcl-web up till
>> TFPWebModule:
>> TFPWebModule -> TCustomFPWebModule -> TSessionHTTPModule -> TCustomHTTPModule
>> -> TDataModule
>>
>> All of them generate this exception, except TDataModule (of course, because
>> the exception raising code is not even running then).
>>
>> My knowledge proved insufficient to solve this so I ask if you guys can come
>> up with something.
>> This exception problem exists even if I just create a normal application and
>> do a
>>
>> var  M : TCustomHTTPModule;
>> begin
>>       M:=TCustomHTTPModule.Create(Form1{Self});//<- crashing here
>>       M.Free;
>> end;
>>
>> for any TDataModule descendant in the above object chain.
>> "Failed to initialize component: No streaming method available."
>> exception is always triggered.
> 
> It is correct. TDataModule is intended to be designed in an IDE, and to load
> itself from a stream. I assume you are not using Lazarus to create your descendents;
> if you were, they would be streamed correctly.
> 
> In that case, we should maybe enable support for non-streamed webdatamodules.
> The only way I can think of is to have a Class method:
>   Class Function Streamed : Boolean;
> which by default returns True. In that case 'CreateNew()' should be used to instantiate
> the datamodule.
> 
> In case you are using Lazarus to do all this, it means you forgot the lresources
> clause in your program's uses clause.
> 
> Michael.
> _______________________________________________
> 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