monkey: Strange crash in master branch
Not sure if it is due to my new testing box is setup way too cutting edge, but here it is. OS: Ubuntu 16.04 PHP-FPM: 7.0.3-3 Monkey: master branch
Monkey HTTP Server v1.7.0
Built : Feb 17 2016 02:57:41 (/usr/bin/cc 5.3.1)
Home : http://monkey-project.com
[+] Process ID is 8697
[+] Server listening on 0.0.0.0:2001
[+] 4 threads, may handle up to 1024 client connections
[+] Loaded Plugins: liana cgi fastcgi logger
[+] Linux Features: TCP_FASTOPEN SO_REUSEPORT
[2016/02/18 01:26:32] [ Info] HTTP Server started
[2016/02/18 01:27:22] [ Error] Segmentation fault (11), code=1, addr=0x8
Aborted (core dumped)
Php page source:
<?php
phpinfo()
?>
The page will load correctly in browser, without crashing Monkey.
But if I use siege (3.1.3) even with single thread, it will crash after 1 transaction.
$ siege -c 1 http://192.168.0.101:2001/info.php
** SIEGE 3.1.3
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.03 secs: 76837 bytes ==> GET /info.php
[error] socket: 528384 connection refused.: Connection refused
[error] socket: 528384 connection refused.: Connection refused
[error] socket: 528384 connection refused.: Connection refused
[error] socket: 528384 connection refused.: Connection refused
^C
Lifting the server siege... done.
Transactions: 1 hits
Availability: 20.00 %
Elapsed time: 3.55 secs
Data transferred: 0.07 MB
Response time: 0.03 secs
Transaction rate: 0.28 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 0.01
Successful transactions: 1
Failed transactions: 4
Longest transaction: 0.03
Shortest transaction: 0.03
A side note, ‘ab’ get completely no response from Monkey, though it work correctly with other website.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 33 (15 by maintainers)
Commits related to this issue
- server: stream: do not remove EOF stream, let channel clean do it (fix #230) Signed-off-by: Eduardo Silva <eduardo@monkey.io> — committed to monkey/monkey by edsiper 8 years ago
- stream: remove EOF stream after processing (FIX #230) Signed-off-by: Eduardo Silva <eduardo@monkey.io> — committed to monkey/monkey by edsiper 8 years ago
Thanks for the explanation about ab. I will leave it as is unless someone else complaint. Looking forward to HTTP/2 support though 😃
thanks for confirm, finally it’s fixed… 😃
the ab tool only handle HTTP/1.0, which means it do not understand Chunked-Transfer responses. When a script generate dynamic content there are two ways to handle, the client needs to know “how much data is coming”, HTTP/1.0 requires “Content-Length”, but from a server side perspective it will mean “buffer the whole dynamic response, and check the length” which can lead to an unnecessary high memory consumption because of a very old client. HTTP/1.1 introduced chunked transfer encoding, which send prefixed chunks of data so the client always know how much data is coming.
ab leaves the connection open expecting a close, which is happening by the timeout. At this point I think would be better to keep safe memory usage in the server than try to be compliant with a very old benchmarking tool. Instead the following tools should be used:
For now I am closing this issue, if we need to revisit ab case we can open a new one.
thanks!
I have pushed a new branch with some internal changes, would you please give it a try:
https://github.com/monkey/monkey/tree/request_done
note: branch request_done