HTTP server application can't deal with a lot of requests
Original Reporter info from Mantis: leledumbo_cool@yahoo.co.id @leledumbo
-
Reporter name: Mario Ray Mahardhika
Original Reporter info from Mantis: leledumbo_cool@yahoo.co.id @leledumbo
- Reporter name: Mario Ray Mahardhika
Description:
I'm continuing my experiment using THTTPServer application, I tried testing the server with httest with this simple script:
CLIENT 2000
_REQ localhost 9000
__GET / HTTP/1.1
__Host: localhost
__
_EXPECT /index/home "HTTP/1.1 200 OK"
_WAIT
END FAILED
END
So basically 2000 requests would be sent to the server at once. This always triggers "Missing HTTP protocol version in request" error which normally comes non-deterministically. The call stack shows:
#0 fpc_raiseexception at :0
#1 PARSESTARTLINE(0xb7928020, 0x0) at ./src/base/fphttpserver.pp:389
#2 TFPHTTPCONNECTION__READREQUESTHEADERS(<error reading variable>) at ./src/base/fphttpserver.pp:437
#3 TFPHTTPCONNECTION__HANDLEREQUEST(<error reading variable>) at ./src/base/fphttpserver.pp:465
#4 TFPCUSTOMHTTPSERVER__DOCONNECT(0xb7de12c0, 0xb7fd3ce0, <error reading variable>) at ./src/base/fphttpserver.pp:605
#5 SSOCKETS$_$TSOCKETSERVER_$__$$_DOCONNECT$TSOCKETSTREAM at :0
#6 RESSTR_$HTTPDEFS_$$_SERRINVALIDREQUESTMETHOD at :0
#7 SSOCKETS$_$TSOCKETSERVER_$__$$_STARTACCEPTING at :0
#8 TFPCUSTOMHTTPSERVER__CREATESERVERSOCKET(<error reading variable>) at ./src/base/fphttpserver.pp:622
#9 TFPCUSTOMHTTPSERVER__SETACTIVE(true, <error reading variable>) at ./src/base/fphttpserver.pp:531
#10 TFPHTTPSERVERHANDLER__RUN(<error reading variable>) at ./src/base/custhttpapp.pp:267
#11 TCUSTOMWEBAPPLICATION__DORUN(<error reading variable>) at ./src/base/custweb.pp:635
#12 CUSTAPP$_$TCUSTOMAPPLICATION_$__$$_RUN at :0
#13 main at tkd1depok.lpr:51
I hope this could be fixed
Steps to reproduce:
- Create any HTTP Server application in Lazarus
- Add an action to the (automatically created) webmodule
- Run the application (better in lazarus, with debug info everywhere)
- Run httest with above script (adjust the parameters)
- The exception would occur
Additional information:
I attach my real project where this behavior occurs
Mantis conversion info:
- Mantis ID: 22260
- OS: i386
- OS Build: 12.04
- Build: 21512
- Platform: linux
- Version: 2.7.1
- Fixed in version: 2.6.4
- Fixed in revision: 24544 (#1895259c)
- Monitored by: » @leledumbo (Mario Ray Mahardhika)
- Target version: 2.7.1