Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

Simple embweb project hangs

18 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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 -------------- next part -------------- A non-text attachment was scrubbed... Name: embwebproj.tar.gz Type: application/x-tar-gz Size: 2232 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110528/894c9149/attachment.bin>

Reply by email

Leonardo M. Ramé
to leledumbo
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.

Reply by email

Leonardo M. Ramé
to Leonardo M. Ramé
Leonardo M. Ram? wrote 11 lines
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.

Reply by email

Joshua Lim
to Leonardo M. Ramé

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

Reply by email

Lee Jenkins
to Leonardo M. Ramé: I updated fpc (with the patch from ABorka that fixes bug 19374) and Lazarus, then rebuild…
Leonardo M. Ram? wrote 29 lines
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

Reply by email

silvioprog
to Joshua Lim: I'm having this error when trying to compile my application hope someone can help.…

Adds path of libc.pas.

2011/5/29, Joshua Lim :

Show quoted text 43 lines
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 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 * ===============================================

Reply by email

Leonardo M. Ramé
to Lee Jenkins: Is it the sole Action on your TFPWebModule? Try setting the Actions' .Default property…
Lee Jenkins wrote 6 lines
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

Reply by email

Joshua Lim
to Mattias Gaertner: On Mon, 30 May 2011 01:24:22 +0800 This might help:…

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

Rgds,
Joshua

Mattias Gaertner wrote 27 lines
On Mon, 30 May 2011 01:24:22 +0800 Joshua Lim 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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Artur Stuczynski
to Leonardo M. Ramé: Thanks. As you said, it doesn't fix the problem, a hang, not a crash. Leonardo M. Ram?…

W dniu 2011-05-29 21:01, Leonardo M. Ram? pisze:

Show quoted text 10 lines
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

Reply by email

Leonardo M. Ramé
to Artur Stuczynski
Artur Stuczynski wrote 36 lines
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.

Reply by email

Leonardo M. Ramé
to Leonardo M. Ramé: Thanks. As you said, it doesn't fix the problem, a hang, not a crash. Leonardo M. Ram?…
Leonardo M. Ram? wrote 11 lines
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.

Reply by email

waldo kitty
to Leonardo M. Ramé
Leonardo M. Ram? wrote 14 lines
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...

Reply by email

Joost van der Sluis
to Leonardo M. Ramé: I found that the hang occurs only when the call was made using curl. With a "real"…
Leonardo M. Ram? wrote 15 lines
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.

Reply by email