[Lazarus] Simple embweb project hangs

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Simple embweb project hangs

Leonardo M. Ramé
Hi, I was trying to create a simple EmbWeb project to test debugging but
it hangs when I call a method from the browser.

To install embweb I did this:

fppkg update
fppkg install embweb

This creates the /.fppkg/lib/fpc/2.5.1/units/x86_64-linux/embweb and
~/.fppkg/lib/fpc/2.5.1/units/x86_64-linux/lnet directories containig
compiled versions of embweb and lnet respectively.

After that, I opened Lazarus and added the package embweb, then rebuild.

The next step was going to Project -> New Project -> Web Application.
Then, I added a new Web Module, an action (marked as default), compiled
and run.

My project's name was "webproject1", the module "TFPWebModule1" and the
action "TFPWebAction0", so, when called from the webbrowser I type this:

http://localhost:7004/webproject1/TFPWebModule1/TFPWebAction0

But instead of replying with the Response.Contents text I assigned to the
Action, it hangs (enters into an infinite-loop). What can be causing
this?.

If I type something wrong, for example http://localhost:7004/foo, I get
this:

<html><head><title>404 Not Found</title></head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

Later I found This message is handled by lNet's http server.

I attached the test project I used for this test.

BTW. I'm using Ubuntu 11.04 - 64bits, with FPC and Lazarus from SVN
trunk updated yesterday.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

embwebproj.tar.gz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

leledumbo
Administrator
Well I got a slightly different condition after updating fpc, lazarus and embweb to their latest version, they finally work fine together. If you haven't please consider upgrading your lazarus and/or fpc first.

Anyway, what's your action code?
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
On 2011-05-29 05:38:29 -0700, leledumbo wrote:
> Well I got a slightly different condition after updating fpc, lazarus and
> embweb to their latest version, they finally work fine together. If you
> haven't please consider upgrading your lazarus and/or fpc first.

I'll try.

> Anyway, what's your action code?

It's in the attached file, in the first message.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
On 2011-05-29 12:04:08 -0300, Leonardo M. Ramé wrote:

> On 2011-05-29 05:38:29 -0700, leledumbo wrote:
> > Well I got a slightly different condition after updating fpc, lazarus and
> > embweb to their latest version, they finally work fine together. If you
> > haven't please consider upgrading your lazarus and/or fpc first.
>
> I'll try.
>
> > Anyway, what's your action code?
>
> It's in the attached file, in the first message.
>

I updated fpc (with the patch from ABorka that fixes bug 19374) and
Lazarus, then rebuild lnet and embweb using fppkg, but the result is the same, when
I call http://localhost:7004/webproject1/TFPWebModule1/TFPWebAction0,
the application hangs.

@Leledumbo, here is the action code:

procedure TFPWebModule1.TFPWebAction0Request(Sender: TObject;
  ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
begin
  AResponse.Content := 'Hello!';
end;

Anyway, if I set a breakpoint in the "AResponse.Content" line, it is
never reached.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Fatal: Can't find unit libc used by file.pp (debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta/ FPC v2.4.0)

Joshua Lim
Hi,

I'm having this error when trying to compile my application hope someone
can help.

"Fatal: Can't find unit libc used by file.pp"

The code: uses libc;

I'm using debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta and FPC version
2.4.0 - installed using Synaptic package manager - these are the latest
at this moment.  I tried upgrading to FPC 2.4.3, recompile lazarus ide
and everything except examples, still same problem.

I did a physical check, the folder \usr\share\fpcsrc\2.4.3\packages\libc
exists.

Using synaptic manager, the following libraries are found:

libc-dev-bin v2.11.2-10
Embedded GNU C Library: Development binaries

libc-bin v2.11.2-10
Embedded GNU C Library: Binaries

libc6 v2.11.2-10
Embedded GNU C Library: Shared libraries

libc6-dev v2.11.2-10
Embedded GNU C Library: Development Libraries and Header Files

Appreciate any thoughts.  Thanks.  :)

Rgds,
Joshua


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Fatal: Can't find unit libc used by file.pp (debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta/ FPC v2.4.0)

Mattias Gaertner
On Mon, 30 May 2011 01:24:22 +0800
Joshua Lim <[hidden email]> wrote:

> Hi,
>
> I'm having this error when trying to compile my application hope someone
> can help.
>
> "Fatal: Can't find unit libc used by file.pp"
>
> The code: uses libc;

This might help:
http://wiki.lazarus.freepascal.org/libc_unit

Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Lee Jenkins
In reply to this post by Leonardo M. Ramé
On 5/29/2011 12:02 PM, Leonardo M. Ramé wrote:

> On 2011-05-29 12:04:08 -0300, Leonardo M. Ramé wrote:
>> On 2011-05-29 05:38:29 -0700, leledumbo wrote:
>>> Well I got a slightly different condition after updating fpc, lazarus and
>>> embweb to their latest version, they finally work fine together. If you
>>> haven't please consider upgrading your lazarus and/or fpc first.
>>
>> I'll try.
>>
>>> Anyway, what's your action code?
>>
>> It's in the attached file, in the first message.
>>
>
> I updated fpc (with the patch from ABorka that fixes bug 19374) and
> Lazarus, then rebuild lnet and embweb using fppkg, but the result is the same, when
> I call http://localhost:7004/webproject1/TFPWebModule1/TFPWebAction0,
> the application hangs.
>
> @Leledumbo, here is the action code:
>
> procedure TFPWebModule1.TFPWebAction0Request(Sender: TObject;
>    ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
> begin
>    AResponse.Content := 'Hello!';
> end;
>
> Anyway, if I set a breakpoint in the "AResponse.Content" line, it is
> never reached.
>

Leonardo,

Is it the sole Action on your TFPWebModule?  Try setting the Actions' .Default
property to true and try that.  I seem to remember that I needed to do that if
there was only one for some reason.

--
Warm Regards,

Lee


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Fatal: Can't find unit libc used by file.pp (debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta/ FPC v2.4.0)

silvioprog
In reply to this post by Joshua Lim
Adds path of libc.pas.

2011/5/29, Joshua Lim <[hidden email]>:

> Hi,
>
> I'm having this error when trying to compile my application hope someone
> can help.
>
> "Fatal: Can't find unit libc used by file.pp"
>
> The code: uses libc;
>
> I'm using debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta and FPC version
> 2.4.0 - installed using Synaptic package manager - these are the latest
> at this moment.  I tried upgrading to FPC 2.4.3, recompile lazarus ide
> and everything except examples, still same problem.
>
> I did a physical check, the folder \usr\share\fpcsrc\2.4.3\packages\libc
> exists.
>
> Using synaptic manager, the following libraries are found:
>
> libc-dev-bin v2.11.2-10
> Embedded GNU C Library: Development binaries
>
> libc-bin v2.11.2-10
> Embedded GNU C Library: Binaries
>
> libc6 v2.11.2-10
> Embedded GNU C Library: Shared libraries
>
> libc6-dev v2.11.2-10
> Embedded GNU C Library: Development Libraries and Header Files
>
> Appreciate any thoughts.  Thanks.  :)
>
> Rgds,
> Joshua
>
>
> --
> _______________________________________________
> Lazarus mailing list
> [hidden email]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


--
Silvio Clécio
===============================================
Blog - <silvioprog.com.br>
Twitter - <twitter.com/silvioprog>
LazSolutions - <code.google.com/p/lazsolutions>
Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR>
===============================================
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===============================================

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
In reply to this post by Lee Jenkins
On 2011-05-29 14:33:02 -0400, Lee Jenkins wrote:
>
> Leonardo,
>
> Is it the sole Action on your TFPWebModule?  Try setting the Actions'
> .Default property to true and try that.  I seem to remember that I needed to
> do that if there was only one for some reason.

Thanks Lee, yes, it's the only action in the web module. Also the
property Default is set to true.

Here is the lfm's contents:

object FPWebModule1: TFPWebModule1
  OldCreateOrder = False
  Actions = <  
    item
      Name = 'TFPWebAction0'
      Default = True
      OnRequest = TFPWebAction0Request
      Template.AllowTagParams = False
    end>
  CreateSession = False
  Height = 172
  HorizontalOffset = 527
  VerticalOffset = 306
  Width = 243
end

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

ABorka
In reply to this post by Leonardo M. Ramé
It will not fix your crash, but you are missing

Handled:=True;

from your action handler.

AB


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
On 2011-05-29 11:56:46 -0700, ABorka wrote:
> It will not fix your crash, but you are missing
>
> Handled:=True;
>
> from your action handler.
>
> AB

Thanks. As you said, it doesn't fix the problem, a hang, not a crash.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Fatal: Can't find unit libc used by file.pp (debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta/ FPC v2.4.0)

Joshua Lim
In reply to this post by Mattias Gaertner
Hi Mattias, thanks, weird, didn't see that in my Googles.  Is there a
list of lazarus deprecated units?

Rgds,
Joshua

Mattias Gaertner wrote:

> On Mon, 30 May 2011 01:24:22 +0800
> Joshua Lim <[hidden email]> wrote:
>
>  
>> Hi,
>>
>> I'm having this error when trying to compile my application hope someone
>> can help.
>>
>> "Fatal: Can't find unit libc used by file.pp"
>>
>> The code: uses libc;
>>    
>
> This might help:
> http://wiki.lazarus.freepascal.org/libc_unit
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> [hidden email]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>  


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Fatal: Can't find unit libc used by file.pp (debian-6.0.1a-i386, Lazarus 0.9.28.2-12 beta/ FPC v2.4.0)

Mattias Gaertner
On Tue, 31 May 2011 15:48:42 +0800
Joshua Lim <[hidden email]> wrote:

> Hi Mattias, thanks, weird, didn't see that in my Googles.  Is there a
> list of lazarus deprecated units?

Actually it is a FPC deprecated unit. The lazarus and fpc wiki are
shared. See here:

http://wiki.freepascal.org/libc_unit

The libc unit is special in many aspects.

I'm not aware of a list of deprecated units.


Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Stootch
In reply to this post by Leonardo M. Ramé
W dniu 2011-05-29 21:01, Leonardo M. Ramé pisze:

> On 2011-05-29 11:56:46 -0700, ABorka wrote:
>> It will not fix your crash, but you are missing
>>
>> Handled:=True;
>>
>> from your action handler.
>>
>> AB
>
> Thanks. As you said, it doesn't fix the problem, a hang, not a crash.

I can (sort of) confirm this behavior. Steps to reproduce:

1. Select new 'Web application' from Lazarus menu
2. Add new action to WebModule, make it default
3. In OnRequest event put:

    AResponse.Content := 'Whatever';
    Handled := True;

4. Launch it within Lazarus
5. Point your browser to: http://localhost:7004/webproject1

I observe series of EResNotFound messages from the application, the
browser seems to be waiting for a reponse until 500 error is displayed
ultimately.

HOWEVER

Launch the webproject1 from command line and everything just works. At
first sight it looks like incorrect integration of Embweb with Lazarus?

Tested on Debian x86_64, Lazarus 0.9.31 and FPC 2.5.1 from trunk updated
two or three days ago.

Artur

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
On 2011-06-06 00:09:11 +0200, Artur Stuczynski wrote:

> W dniu 2011-05-29 21:01, Leonardo M. Ramé pisze:
> >On 2011-05-29 11:56:46 -0700, ABorka wrote:
> >>It will not fix your crash, but you are missing
> >>
> >>Handled:=True;
> >>
> >>from your action handler.
> >>
> >>AB
> >
> >Thanks. As you said, it doesn't fix the problem, a hang, not a crash.
>
> I can (sort of) confirm this behavior. Steps to reproduce:
>
> 1. Select new 'Web application' from Lazarus menu
> 2. Add new action to WebModule, make it default
> 3. In OnRequest event put:
>
>    AResponse.Content := 'Whatever';
>    Handled := True;
>
> 4. Launch it within Lazarus
> 5. Point your browser to: http://localhost:7004/webproject1
>
> I observe series of EResNotFound messages from the application, the browser
> seems to be waiting for a reponse until 500 error is displayed ultimately.
>
> HOWEVER
>
> Launch the webproject1 from command line and everything just works. At first
> sight it looks like incorrect integration of Embweb with Lazarus?
>
> Tested on Debian x86_64, Lazarus 0.9.31 and FPC 2.5.1 from trunk updated two
> or three days ago.
>
> Artur

Hi Artur, please try adding LResources to your main project (.lpr) file.

Apart from this, I would like to ask you to take a look at the new
httpserver that Michael added to fcl-web in the trunk svn revision of
fpc. There's an example for Lazarus in /packages/fcl-web/examples/httpapp.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Leonardo M. Ramé
In reply to this post by Leonardo M. Ramé
On 2011-05-29 16:01:29 -0300, Leonardo M. Ramé wrote:

> On 2011-05-29 11:56:46 -0700, ABorka wrote:
> > It will not fix your crash, but you are missing
> >
> > Handled:=True;
> >
> > from your action handler.
> >
> > AB
>
> Thanks. As you said, it doesn't fix the problem, a hang, not a crash.
>

I found that the hang occurs only when the call was made using curl.
With a "real" browser it works ok.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

wkitty42
On 6/5/2011 19:47, Leonardo M. Ramé wrote:

> On 2011-05-29 16:01:29 -0300, Leonardo M. Ramé wrote:
>> On 2011-05-29 11:56:46 -0700, ABorka wrote:
>>> It will not fix your crash, but you are missing
>>>
>>> Handled:=True;
>>>
>>> from your action handler.
>>>
>>> AB
>>
>> Thanks. As you said, it doesn't fix the problem, a hang, not a crash.
>>
> I found that the hang occurs only when the call was made using curl.
> With a "real" browser it works ok.

sounds like we need to take a look at those curl generated http headers and see
if there's something there that's not being parsed properly...


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Simple embweb project hangs

Joost van der Sluis
In reply to this post by Leonardo M. Ramé
On Sun, 2011-06-05 at 20:47 -0300, Leonardo M. Ramé wrote:

> On 2011-05-29 16:01:29 -0300, Leonardo M. Ramé wrote:
> > On 2011-05-29 11:56:46 -0700, ABorka wrote:
> > > It will not fix your crash, but you are missing
> > >
> > > Handled:=True;
> > >
> > > from your action handler.
> > >
> > > AB
> >
> > Thanks. As you said, it doesn't fix the problem, a hang, not a crash.
> >
>
> I found that the hang occurs only when the call was made using curl.
> With a "real" browser it works ok.

That's very well possible. I know that Opera also doesn't cope with
embweb.

Joost.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus