Lazarus

Programming => Networking and Web Programming => Topic started by: Soner on August 24, 2020, 12:28:53 pm

Title: TFPHTTPServer doesn't respond next day.
Post by: Soner on August 24, 2020, 12:28:53 pm
Hello,
I created webapp with TFPHTTPServer. My app-server does not respond after a while.
Sometimes it shows the exception 'No REQUEST_METHOD passed from server.'.
Does anyone know the solution?


I uploaded a test program. I started testprogramm last friday, then it stopped to respond saturday afternoon.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Soner on August 30, 2020, 03:46:58 pm
Isn't anyone using fphttpserver?
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Thaddy on August 30, 2020, 05:29:48 pm
I do. Did you try the example?
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Leledumbo on August 30, 2020, 09:17:00 pm
Sometimes it shows the exception 'No REQUEST_METHOD passed from server.'.
Should be internal exception only, never goes out to the client.
I uploaded a test program. I started testprogramm last friday, then it stopped to respond saturday afternoon.
I cannot confirm. I run an even more complex app than this, has both HTML and API endpoints and running 24/7 with MySQL backend. Never goes down. There might be OS influence or something else. When it stops responding, can you confirm that the port it binds to is still open?
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Soner on August 31, 2020, 05:42:40 pm
I do. Did you try the example?
Which example? Do you mean from "fpc\source\packages\fcl-web\examples\httpserver", my example and app build up on this example.

Maybe I should use libmicrohttp. GNU things are mostly more matured than fpc things. This example ist build on GNU-Libmicrohttp, I will test it this week:
fpc\3.2.0\source\packages\fcl-web\examples\simpleserver


I uploaded a test program. I started testprogramm last friday, then it stopped to respond saturday afternoon.
I cannot confirm. I run an even more complex app than this, has both HTML and API endpoints and running 24/7 with MySQL backend. Never goes down. There might be OS influence or something else. When it stops responding, can you confirm that the port it binds to is still open?
I don't think it is OS thing, the computer is only for this server app. When I next day restrat the server-app, it works without error.
What is your server class, TFPHTTPServer, TCustomMicroHTTPApplication, TCustomHTTPApplication?

I must say, it is public server, it has ip4 adress. Sometimes it is scanned by a ip4-scanner.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Leledumbo on August 31, 2020, 08:31:56 pm
I don't think it is OS thing, the computer is only for this server app. When I next day restrat the server-app, it works without error.
What is your server class, TFPHTTPServer, TCustomMicroHTTPApplication, TCustomHTTPApplication?

I must say, it is public server, it has ip4 adress. Sometimes it is scanned by a ip4-scanner.
I don't use the custom class, I just the ready to use THTTPApplication. It's reverse proxified by nginx as we use the same SSL termination point across all services.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Soner on August 31, 2020, 09:51:14 pm
I don't use the custom class, I just the ready to use THTTPApplication. It's reverse proxified by nginx as we use the same SSL termination point across all services.
THTTPApplication is  TCustomHTTPApplication.
Sorry I did'nt understand it, are you using fastcgi application with nginx?
I wrote a basic fastcgi app for nginx, that executes pascal script apps.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: PierceNg on September 01, 2020, 07:08:12 am
Maybe I should use libmicrohttp. GNU things are mostly more matured than fpc things. This example ist build on GNU-Libmicrohttp, I will test it this week:
fpc\3.2.0\source\packages\fcl-web\examples\simpleserver

Remember Pascal is not C, meaning the the rest of fcl-web and your application talks to libmicrohttpd via fcl-web's libmicrohttpd wrapper written in ... Pascal.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Leledumbo on September 01, 2020, 10:29:59 am
Sorry I did'nt understand it, are you using fastcgi application with nginx?
No, I use the the embedded HTTP server via THTTPApplication with nginx in front of it (proxy_pass directive in nginx, not fastcgi_pass).
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Thaddy on September 01, 2020, 02:30:12 pm
Which example? Do you mean from "fpc\source\packages\fcl-web\examples\httpserver", my example and app build up on this example.
Well, just for you I have the example running for neigh 1,5 day , so more than 24 hours and counting...
(On Linux) I might be wrong but if you base something on working code and it does not work anymore, where's the blame?
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Soner on September 02, 2020, 10:40:55 am
@leledumbo
Thanks for the information. Maybe I should do same.
My program was connected to four IP addresses when it didn't respond. According to abuseipdb (https://www.abuseipdb.com/) the adresses belongs to "hacker groups" in Russia, China and USA.
@thaddy
I'm not looking for someone to blame. Thanks for information.
Private examples are running over weeks without errors on private networks.
I think the ip4scanner/hackers doing something with server, so the server doesn't responds more.
Title: Re: TFPHTTPServer doesn't respond next day.
Post by: Soner on September 02, 2020, 11:15:51 am
I think maybe I have found the solution to the problem.
Some computers are permanently connected to the server, and the server cannot answer new connection request.
I try to increase Server.Queue Size and block computers that send too many requests in last minutes.
Title: I think TFPHTTPServer has a bug on Windows.
Post by: Soner on October 23, 2020, 10:22:21 am
Hello,
i wrote a small httpserver-app. It runs on public ip4-adress. I don't published the ipadress, only I and ip4-scanner surfing on my server.
The Server app freezing after one or two days. All my test apps based on TFPHTTPServer like pure TFPHTTPServer or THTTPApplication which based on TFPHTTPServer freezes.
But test server based on Indy or Lhttp running without error.

Does anyone have a TFPHTTPServer-App running on Windows without error?

My Specs:
Windows 10 pro 64Bit, Lazarus 2.0.11 Svn-Rev.63689, Fpc 3.0.4 Win 64.

I upload my test-server projects, if someone want try it.

Edit:
Look at my other topic:
https://forum.lazarus.freepascal.org/index.php/topic,51178.0.html (https://forum.lazarus.freepascal.org/index.php/topic,51178.0.html)
TinyPortal © 2005-2018